Olympic Games
InterviewTime limit2sMemory limit1024 MB
Given n medal sets of gold, silver, and bronze winners, find the country that ranks first by medal counts, breaking ties by name.
Problem
Working as a regular commentator at the Olympic Games is extremely difficult. Consider how many competitions must be covered. Not every competition is fast-paced, so the commentator often has a lot of airtime to fill with various stories.
The famous commentator Dima learned from a reliable source that a general rehearsal was held before the first Olympic Games to find flaws in the organization. Dima also found out, for each of the medal sets awarded at the rehearsal, the names of the countries whose representatives received the gold, silver, and bronze medals.
Dima wants to read the results of the unofficial team standings of the rehearsal Olympics on air, but he cannot calculate them. He asks you to write a program that helps him correctly determine at least the winning country of the standings.
The first criterion is the number of gold medals won by a country's representatives. The second is the number of silver medals, and the third is the number of bronze medals. Finally, if two countries have the same numbers of gold, silver, and bronze medals, the country whose name is lexicographically smaller is ranked higher. For example, suppose three countries took part in the competition: <<RUSSIA>> (4 gold, 6 silver, 5 bronze), <<ALBANIA>> (4, 0, 2), and <<RUSIA>> (4, 6, 5). Then <<RUSIA>> takes first place, <<RUSSIA>> takes second, and <<ALBANIA>> takes third.
Input
The first line contains the number (), the number of medal sets awarded at the rehearsal. Each of the next lines contains three words separated by spaces. Each word consists of uppercase Latin letters and is the name of a country whose representatives received the gold, silver, and bronze medal, respectively. Each line of the input file is at most 200 characters long.
Output
Print the name of the winning country of the unofficial team standings.