proposals

Priya is so much beautiful , everybody want to be in a relationship with her . So it 's the Valentine's day , many person come to propose her but she can't decide what to do . So she simply follow a rule the person which request her most will be selected by her.
So you have to find the person which request her most.

Input :
The first line contains T - number  of test cases . Each of next T lines contain a string S.

Output :
For each test case you need to print maximum occurring characters with their count followed by a single space.

Constraints :
1 ≤ T ≤ 50
1 ≤ |S| ≤ 100, where |S| denotes the length of string S.

Note : Output will be in sorted manner !

SAMPLE INPUT
3
aabbcc
aabcde
abcdefgh

SAMPLE OUTPUT
abc 2
a 2
abcdefgh 1

Explanation

Here abc occurs same times :  abc 2

Here a occurs maximum times then others :  a 2

Here everyone has the same occurring frequency :  abcdefgh 1

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions: