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: 3ms
Memory: 1764kB
Author: 2018212212187
In contest: 1284

#include<iostream>
#include<algorithm>
using namespace std;
struct room{
	char str[21];
	int rank;
}student [100];
bool cmp(room a,room b){
	return a.rank>b.rank;
}
int main(){
	int T;
	scanf("%d",&T);
	while(T--){
		int N;
		scanf("%d",&N);
		for(int i=0;i<N;i++){
			scanf("%s %d",student[i].str,&student[i].rank);
		}
		sort(student,student+N,cmp);
		for(int i=0;i<N;i++){
			printf("%s\n",student[i].str);
		}
	}
	return 0;
}