//计算智能校赛排名!
/*
include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
define IOS ios::sync_with_stdio(0),cin.tie(0);
const int N = 5000009;
typedef long long ll;
struct candidate{
int AC;
int time;
string name;
int id;
};
bool cmp(candidate a,candidate b){
if(a.AC != b.AC){
return a.AC>b.AC;
}
else if(a.time != b.time){
return a.time < b.time;
}
else{
return a.id < b.id;
}
}
int main(){
IOS;
vector[HTML_REMOVED] list;
int n;
cin>>n;
for(int i = 1; i<=n;i++){
int AC,time;
string name;
cin>>AC>>time>>name;
list.push_back({AC,time,name,i});
}
sort(list.begin(),list.end(),cmp);
for(candidate one : list){
cout<<one.name<<endl;
}
return 0;
}
*/