rt
#define I return
#define AK 0
#define IOI ;
#include "bits/stdc++.h"
using namespace std;
struct x{
string a;
int b,c,d;
}e[101];
bool cmp(x m,x n){
if(m.b>n.b){
return 1;
}else{
if(m.b<n.b){
return 0;
}else{
if(m.c>n.c){
return 1;
}else{
if(m.c<n.c){
return 0;
}else{
if(m.d>n.d){
return 1;
}else{
return 0;
}
}
}
}
}
}
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++)cin>>i[e].a>>i[e].b>>i[e].c>>i[e].d;
sort(e+1,e+n+1,cmp);
for(int i=n;i>=1;i--)cout<<i[e].a<<endl;
I AK IOI
}
求问函数哪出问题了