BETA

Difficulty Level: Basic

Submissions: 1975 Accuracy:

27.44%

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 Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Jha

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

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