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: 2018212212026
In contest: 1284

#include<cstdio>
#include <algorithm>
#include <iostream>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn=100005;
struct node
{
       char a[21];
       int b;
}arr[100];
bool cmp(const node &x,const node &y){
	if(x.b!=y.b)return x.b>y.b;
	return 0;
}
int main()
{
	int t,n;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		for(int i=1;i<=n;i++)
		{
			scanf("%s %d",arr[i].a,&arr[i].b);
		}
		sort(arr+1,arr+1+n,cmp);
		for(int i=1;i<=n;i++)
		{
			printf("%s\n",arr[i].a);
		}
	}
//	system("pause");
}