1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 #include<math.h> 5 using namespace std; 6 struct AC 7 { 8 char id[25]; 9 int num; 10 int time; 11 }ac[110]; 12 bool cmp(AC a,AC b) 13 { 14 return a.num!=b.num?a.num>b.num:a.time!=b.time?a.time<b.time:strcmp(a.id,b.id)<0; 15 } 16 int main() 17 { 18 int t,n,i; 19 scanf("%d",&t); 20 while(t--) 21 { 22 scanf("%d",&n); 23 for(i=0;i<n;i++) 24 scanf("%s%d%d",ac[i].id,&ac[i].num,&ac[i].time); 25 sort(ac,ac+n,cmp); 26 printf("%s ",ac[0].id); 27 } 28 return 0; 29 } 30