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: 8ms
Memory: 1772kB
Author: 2018212212236
In contest: 1284

#include<iostream>
#include<iomanip>
#include<cstdio>
#include<deque>
#include<cmath>
#include<cctype>
#include<algorithm>
#include<string>
using namespace std;
struct m {
	string name;
	int num;
};
deque<m>a;
bool cmp1 (int x, int y) {
	return x < y;
}
bool cmp (m x, m y) {
	return x.num > y.num;

}
int main() {
   int t, i, j;
   cin >> t;
   while(t--) {
	   int n;
	   cin >> n;
	   while(n--) {
		   m aa;
		   cin >> aa.name >> aa.num;
		   a.push_back(aa);
	   }
	   sort(a.begin(), a.end(), cmp);
	   for(i = 0; i < a.size(); i++) {
		   cout << a[i].name;
		   if(i != a.size() - 1)
			   cout << endl;
	   }
	   if(t != 0)
		   cout << endl;
	   a.clear();
   }
   
   return 0;
}