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: 1132kB
Author: 2018212212075
In contest: 1284

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
struct node
{
	char s[50];
	int d;
} loy[105];
int cmp(const node x,const node y)
{
	return x.d  > y.d  ;
	
}
int main()
{
	int t=0;
	scanf("%d",&t);
	while(t--)
	{
		int n=0;
		scanf("%d",&n);
		for(int i=0;i<n;i++)
		{
			scanf("%s%d",loy[i].s ,&loy[i].d );
		}
		sort(loy,loy+n,cmp);
		for(int i=0;i<n;i++)
		{
			printf("%s\n",loy[i].s);
		}
	}
	return 0;
}