During the conduct of the Olympiad, each user was assigned a registration number, which is a natural number. It is necessary to sort the list of Olympiad participants according to the points they scored.
The first line provides the number (1 ≤ N ≤ 1000) representing the count of participants. Each subsequent line contains the corresponding participant's registration number and the value of the scores they obtained. All numbers in the input file do not exceed 10^5.
Output the current list in descending order of points. If some participants have the same score, then they should be sorted among themselves in ascending order of their registration numbers.
Example 1
Example 2