408897: GYM103373 A Olympic Ranking
Description
The Olympic Games are the most important sporting events in human history. Usually, the Olympic Games are held every four years. However, the 2020 Olympic Games just finished in August 2021 due to the COVID-19 outbreaks.
There are more than 200 nations participating in the Olympic Games. Thousands of athletes around the world compete in various sports. The athletes represent their countries or National Olympic Committees (NOCs) to compete for medals. Therefore, each country or NOC may win medals in the competitions.
There are three types of medals: gold medals, silver medals, and bronze medals. Typically, the gold medals are awarded to the winners of the competitions, and silver medals are awarded to the runner-ups. Most of the bronze medals are awarded to the second runner-ups. However, there can be no second runner-up in some sports. The bronze medals can be awarded in different manners. For example, in a few tournament sports, such as wrestling, boxing, and judo, two bronze medals are awarded to the eliminated semi-finalists.
A country or NOC has a better rank than another country or NOC if one of the following conditions holds.
- It wins more gold medals.
- It wins the same amount of gold medals, and it wins more silver medals.
- It wins the same amount of gold medals and silver medals, and it wins more bronze medals.
Please write a program to find the country or NOC which has the best rank among all countries and NOCs.
InputThe first line of the input contains one positive integer $$$n$$$. Then $$$n$$$ lines follow. Each of the following lines contains three non-negative integers $$$g$$$, $$$s$$$, $$$b$$$, and the name of a country or NOC. They are separated by blanks.
- $$$1\le n< 300$$$
- $$$g, s, b \in \{0,1,\dots,999\}$$$
- There is only one country or NOC of the best rank.
- The names of countries and NOCs consist of only printable ASCII characters.
- The size of an input file does not exceed 3 megabytes.
Print the name of the country or NOC of the best rank.
ExamplesInput4 22 21 22 Great Britain 27 14 17 Japan 39 41 33 United States of America 20 28 23 ROCOutput
United States of AmericaInput
3 999 999 998 Malaysia 999 999 999 Thailand 999 998 999 IndonesiaOutput
Thailand