13744 - Free the grades   

Description

Bojack has a list of names from the programming class. He needs to sort the list from the best grades to the lowest in order to know the best and worst student in the class. Help the Bojack to sort the grades! Note that everyone has a unique name, so if they have the same grades, sort it from Z to A. (Not A to Z!)

This is a partial judge program.

Input

The first line consists of an integer the number of testcases

For each testcase, there is an integer , the number of students

For the next n line, each line consists of an integer m and string s, representing the grade and name of the student

< < 10

< n,m < 50

< < 100000

 

Output

The lists of students name in descending order.

Sample Input  Download

Sample Output  Download

Partial Judge Code

13744.c

Partial Judge Header

13744.h

Tags




Discuss