You have records of employee name as string (Ename) and salary as positive integer (S). You have to sort the records on the basis of employee salary, if salary is same then use employee name for comparison.
The first line consists of a number T denoting the number of test cases. Each test case will consist of a integer N denoting number of employees followed by the name and salary of the employee with spaces.
Each test case consists of a single line. It consists of the name and salary of the employees with spaces.
1 <= T <= 200
1 <= N <= 1000
1 <= Ename <= 106
1 <= S <= 106
xbnnskd 100 geek 50
shyam 50 ram 50
geek 50 xbnnskd 100
ram 50 shyam 50
Testcase 1: geek has lowest salary as 50 and xbnnskd has more salary. So sorted output is as given in sample.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.