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: 1976kB
Author: 2018212212122
In contest: 1284

#include <cstdio>
#include <iostream>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int n,m,i,j,k;
int f[114];
map<int,int>ff;
struct node{
	char s[1919];
	int k;
}kk[114];
bool cmp(const node &a,const node &b){
	return a.k>b.k;
}
int main()
{
	int t;
	cin>>t;
	while(t--){
		cin>>n;
		for(i=0;i<n;++i)
		{
			scanf("%s %d",kk[i].s,&kk[i].k);
		}
		sort(kk,kk+n,cmp);
		for(i=0;i<n;++i)
			cout<<kk[i].s<<endl;
	}
	return 0;
}