#K65007. Bird Watching Frequency

    ID: 32101 Type: Default 1000ms 256MiB

Bird Watching Frequency

Bird Watching Frequency

You are given a list of bird watching journal entries. Each entry is a string in the format HH:MM,BirdSpeciesName, where HH:MM represents the time the observation was made (which is not used for processing), and BirdSpeciesName is the name of the bird observed.

Your task is to determine which bird species was observed most frequently. In the event of a tie, you must output the species names as a comma-separated list in alphabetical order.

Note that the input must be read from STDIN and the result must be printed to STDOUT.

Example:
For the input:

8
06:15,Robin
07:20,Robin
08:45,Sparrow
10:50,Bluejay
14:00,Sparrow
15:30,Bluejay
16:00,Robin
18:30,Bluejay
The output should be:
Bluejay,Robin
because both Bluejay and Robin are observed 3 times and are the most frequent, and in alphabetical order they appear as Bluejay,Robin.

inputFormat

The first line of input contains an integer N (1 ≤ N ≤ 10^5), the number of journal entries. The next N lines each contain a journal entry in the format HH:MM,BirdSpeciesName.

outputFormat

Output a single line containing the bird species that appears most frequently. In case of a tie, output a comma-separated list of those species names in alphabetical order.## sample

1
06:15,Robin
Robin