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: 4ms
Memory: 2024kB
Author: 2017210904069
In contest: 1284

#include<bits/stdc++.h>
using namespace std;
struct abc{
	char str[21];
	int count;
};
int cmp(abc a,abc b){
	return a.count>b.count;
}
int main(){
	int t,i,n;
	struct abc o[101];
	scanf("%d",&t);
	while(t--){
		scanf("%d",&n);
		for(i = 0;i<n;i++){
			scanf("%s %d",&o[i].str,&o[i].count);
		}
		sort(o,o+n,cmp);
		for(i = 0;i<n;i++){
			printf("%s\n",o[i].str);
		}
	}
}