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: 1128kB
Author: 2018212212096
In contest: 1284

#include<stdio.h> 
#include<string.h>
#include<algorithm>

using namespace std;


struct xx {
	char name[25];
	int iCount;
}xx[105];

bool cmp(struct xx a,struct xx b) {
	return a.iCount>b.iCount;
}

int main() {
	int t;
	scanf("%d",&t);
	while(t--) {
		int n;
		scanf("%d",&n);
		for(int i=0;i<n;i++) {
			scanf("%s",xx[i].name);
			scanf("%d",&xx[i].iCount);
		}
		sort(xx,xx+n,cmp);
		for(int i=0;i<n;i++) {
			printf("%s\n",xx[i].name);
		}
	}
	return 0;
}