#Z17104. 成绩排序

成绩排序

Description

Given a grade sheet for a certain course in a class, please sort and output the sheet in descending order of grades. If there are identical grades, students with names that come first in dictionary order should appear first.

Input Format

The first line contains an integer n (0 < n < 20), representing the number of students in the class.
The following n lines each contain a student's name and their corresponding grade, separated by a single space.
The name consists of letters only and has a maximum length of 20. The grade is a non-negative integer no greater than 100.

Output Format

Sort the grade sheet in descending order of grades and output the result. Each line should contain a name and a grade, separated by a single space.

4
Kitty 80
Hanmeimei 90
Joey 92
Tim 28


Joey 92
Hanmeimei 90 
Kitty 80
Tim 28