#P415. 练71.1成绩排序
练71.1成绩排序
Description
Given a grade report for a course in a class, please sort and output the report by grades from highest to lowest. If there are students with the same grade, sort them by name in lexicographical order.
Input Format
The first line contains (), indicating the number of students in the class;
The next lines each contain a student's name and grade, separated by a single space. The name contains only letters and has length not exceeding , and the grade is a non-negative integer not exceeding .
Output Format
Sort the grade report by grades from highest to lowest and output it. Each line contains the name and grade, separated by a space.
Sample
4
Kitty 80
Hanmeimei 90
Joey 92
Tim 28Joey 92
Hanmeimei 90
Kitty 80
Tim 28