BETA

Submissions : 951 Accuracy :

26.5

Sorting Employees
         

You have records of employee name and salary.You have to sort the records on the basis of employee salary,if same then by employee name.

Input:
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.

Output:
Each test case consists of a single line. It consists of the name and salary of the employees with spaces.

Constraints:
1<=T<=200
1<=N<=1000
1<=Max length of name <= 100
1<= salary of employee <=10^6

Example:
Input:

2
2
xbnnskd 100 geek 50
2
shyam 50 ram 50
Output:
geek 50 xbnnskd 100
ram 50 shyam 50

**For More Examples Use Expected Output**


Contributor: Ayush Jha

Set Default Code

					   
Result:
It is recommended to test your code before clicking 'Submit' button!



                   



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.