#C10817. Most Common Cryptokitty Traits

    ID: 40064 Type: Default 1000ms 256MiB

Most Common Cryptokitty Traits

Most Common Cryptokitty Traits

You are given one or more datasets representing collections of Cryptokitties. Each dataset starts with an integer T (with \(1 \le T \le 100\)), representing the number of Cryptokitties in that dataset. The following T lines contain space-separated traits that describe each Cryptokitty. The input ends with a line containing the integer 0, which should not be processed.

Your task is to find the most common trait(s) in each dataset. If there are multiple traits with the same highest frequency, output them in alphabetical order (each separated by a single space). Each dataset's result should be printed on a separate line.

Example:

Input:
4
whiskers playful blueeyes
fluffy blueeyes
playful greeneyes
playful whiskers
3
longtail agile
shorttail sneaky
agile greeneyes
0

Output: playful agile

</p>

inputFormat

The input consists of multiple test cases. Each test case begins with an integer T (\(1 \le T \le 100\)), representing the number of Cryptokitties. The next T lines each contain several traits (each trait is a lowercase string with at most 16 characters) separated by spaces. The sequence of test cases terminates with a line that contains the integer 0. Do not process the terminating line.

outputFormat

For each test case, output a single line containing the most frequent trait(s). If there are multiple traits with maximum frequency, they should be output in alphabetical order, separated by a single space.

## sample
4
whiskers playful blueeyes
fluffy blueeyes
playful greeneyes
playful whiskers
3
longtail agile
shorttail sneaky
agile greeneyes
0
playful

agile

</p>