Start: Jul, 06, 2019 10:00:00
20190706Python程序设计基础培训扩展练习
End: Jul, 17, 2019 12:00:00
Time elapsed:
Time remaining:

Problem_ID: B
Result: Accepted
Time: 56ms
Memory: 25316kB
Author: 13666776648
In contest: 1300

for i in range(int(input())):
    lst=[]
    
    for j in range(int(input())):
        a=input().split()
        lst.append([a[0],int(a[1])])
    
    lst.sort(key=lambda n:n[1],reverse=True)
    
    for tcase in lst:
        print(tcase[0])