Etaoin Shrdlu

No attempts yetTime limit1sMemory limit128 MB

Problem

The relative frequency of characters in natural-language text matters a great deal in cryptography, but the statistics differ from language to language. Here are the nine most frequent characters, ordered by relative frequency, for several common languages:

English: ETAOINSHR
German:  ENIRSATUD
French:  EAISTNRUL
Spanish: EAOSNRILD
Italian: EAIONLRTS
Finnish: AITNESLOK

Just as important as the frequencies of single characters are the frequencies of pairs of adjacent characters, called digrams. A digram is any two consecutive characters of the text, and the pairs overlap: a run of $k$ identical characters contains $k-1$ equal digrams. Given several text samples, find the digrams with the highest relative frequencies.

Input

The input contains several test cases. Each test case starts with a line holding a single integer $n$, the number of text lines in the case. Then follow $n$ lines, each at most $80$ characters long. Concatenating these $n$ lines, with the line-break characters removed, yields the text sample to analyze. The sample consists of printable ASCII characters only.

The constraint is $1 \le n \le 64$. A line with $n = 0$ terminates the input and is not processed.

Output

For each test case output 5 lines, one for each of the 5 most frequent digrams. On each line print the digram itself (two characters), a single space, the absolute number of occurrences, another single space, and the relative frequency — that is, the number of occurrences divided by the total number of digrams in the sample. Round the relative frequency to exactly 6 decimal places.

When two digrams occur equally often, order them by their (ASCII) values, smaller first. Separate the output of consecutive test cases with a blank line.