#t268. 成绩排序

成绩排序

Sorting Scores

Problem Background

Special for beginners, ^_^

Problem Description

Given a class transcript for one course, please sort and output it by score from highest to lowest. If scores are equal, the name that is lexicographically smaller comes first.

Input Format

The first line is n (0<n<20)n\ (0 < n < 20), the number of students in the class.

The following nn lines each contain one student's name and score, separated by a single space. The name contains only letters and has length at most 2020; the score is a non-negative integer not exceeding 100100.

Output Format

Sort the transcript by score from highest to lowest and output it. Each line contains the name and the score, separated by one space.

Sample Input

4
Kitty 80
Hanmeimei 90
Joey 92
Tim 28

Sample Output

Joey 92
Hanmeimei 90
Kitty 80
Tim 28

Constraints

1s, 1024KiB for each test case.