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.
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).
For each testcase, output the name of students with their marks in decreasing order, each student in new line.
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
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.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes