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.
The first line consists of an integer T the number of testcases
For each testcase, there is an integer n , 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
1 < T < 10
1 < n,m < 50
1 < s < 100000
The lists of students name in descending order.