Competitions
2-й этап Всеукраинской олимпиады по информатике 2013-2014 уч.г. г.Житомир
The results of the Olympiad
During the contest, each participant received a unique identification number - a positive integer. Need to sort a list of participants of the Olympiad on the number of points scored.
Input data
The first line contains the number N
(1 ≤ N ≤ 1000
) - the number of participants. In each following line gives an identification number and dialed the number of points corresponding to the participant. All numbers in the input file does not exceed 10^5
.
Output data
The output file output source list in descending order of points. If some participants in the same score, they each want to sort in ascending order of ID number.
Examples
Input example #1
3 101 80 305 90 200 14
Output example #1
305 90 101 80 200 14
Input example #2
3 20 80 30 90 25 90
Output example #2
25 90 30 90 20 80