Student of the Year
Easy Accuracy: 31.32% Submissions: 6294 Points: 2

Given a vector containing name of N student (in lowercase letters) and their marks in an exam. The task is to sort the students with respect to their marks (student with highest marks will be on top). If marks are same, consider lexicographic sorting for names.


Input Format:
First line of input contains number of testcases T. First line of each testcase contains N, number of students. Next line contains data of N students name and marks seperated by space (name, marks).

Output Format:
For each testcase, output the name of students with their marks in decreasing order, each student in new line.

Your Task:
Since this is a function problem, you don't need to take any input. You just need to complete the provided function sortMarks().

1 <= T <= 100
1 <= N <= 106
1 <= marks <= 106


michal 56
john 100
abbas 98
jordan 45

john 100
abbas 98
michal 56
jordan 45

Testcase 1:
marks of students in decreasing order is as 100, 98, 56, 45. So, their names are as john 100, abbas 98, michal 56, jordan 45.

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Student of the Year

Output Window