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: 2028kB
Author: 2018212212136
In contest: 1284

#include<bits/stdc++.h>
using namespace std;

struct WH{
	char name[30];
	int point;
}wh[110];
int cmp(WH a,WH b)
{
	return a.point > b.point;
}
int main()
{
	int t;
	scanf("%d",&t);
	int n;
	while(t--)
	{
		scanf("%d",&n);
		for(int i = 0;i < n;++i)
		{
			cin >> wh[i].name;
			scanf("%d",&wh[i].point);
		}
		sort(wh,wh+n,cmp);
		for(int i = 0;i < n;++i)
		{
			printf("%s\n",wh[i].name);
		}
	}
}