B

Document Analyzer

Input: Standard Input

Output: Standard Output

 

You work in a leading software development company. As you are great in coding, most of the critical tasks are allotted for you. You like the challenge and you feel excited to solve those problems.

 

Recently your company is developing a project named Document Analyzer. In this project you are assigned a task; of course a critical task. The task is that you are given a document consisting of lowercase letters, numbers and punctuations. You have to analyze the document and separate the words first. Words are consecutive sequences of lower case letters. After listing the words, in the order same as they occurred in the document, you have to number them from 1, 2, ... n. After that you have to find the range p and q (p ≤ q) such that all kinds of words occur between p and q (inclusive). If there are multiple such solutions you have to find the one where the difference of p and q is smallest. If still there is a tie, then find the solution where p is smallest.

Since you do have other works to do, you have to solve this task within 5 hours.

 

Input

First line of input will contain T (≤ 20) denoting number of documents.

Each document will be denoted by one or more lines, each line having no more than 150 characters. A document will contain either lowercase letters or numbers or punctuations. The last line of a document will contain the word ‘END’ which is of course not the part of the document. You can assume that a document will contain between 1 and 105 words (inclusive).

 

Output

For each document, print the document number first. After that, print p and q as described above. For exact formatting, see the samples.

 

Sample Input                             Output for Sample Input

3
1. a case is a case, 
2. case is not a case~
END
a b c d e
END
a@#$a^%a a a
b b----b b++12b
END
 
Document 1: 6 9
Document 2: 1 5
Document 3: 5 6

The input file size is about 9 MB, so use faster input techniques.


Problemsetter: Jane Alam Jan, Special Thanks: Abdullah-al-Mahmud