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: 2040kB
Author: 2018212212130
In contest: 1284

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