By Leonardo Fernandes, IFSC Brazil
Somebody messed up the olympic medal table. Your program must put it back in the right order. The order of the countries in the medal table is given by the number of gold medals. If there's a tie in the number of gold medals, than the country with more silver medals win. If there's a tie in both gold and silver medals, the country with more bronze medals should be above. If two or more nations tie in the three kinds of medals, your program must show them in alphabetic order.
Input is the number of participating nations N (0 ≤ N ≤ 500), followed by the list of countries and their gold G (0 ≤ G ≤ 10000), silver S (0 ≤ S ≤ 10000) and bronze B (0 ≤ B ≤ 10000) medals.
Output should be the list of countries and their gold, silver and bronze medals shown in the specified order.
|Input Sample||Output Sample|
Franca 10 18 14