Start: Jul, 10, 2019 08:30:00
2019年度暑期短学期达标测试补考
End: Jul, 10, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: H
Result: Accepted
Time: 5ms
Memory: 1764kB
Author: 2018212212048
In contest: 1284

#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
struct node{
	string name;
	int times;
}a[100];

bool CMP(const node &a,const node &b){
	return a.times>b.times;
}

int main(){
	int t;
	cin>>t;
	int n;
	while(t--){
		cin>>n;
		for(int i=1;i<=n;i++){
			cin>>a[i].name>>a[i].times;
		}
		sort(a+1,a+1+n,CMP);
		for(int i=1;i<=n;i++){
			cout<<a[i].name<<endl;
		}
	}
	
}