#include <bits/stdc++.h>
using namespace std;
struct ban{
string name;
long long sg,id;
};
bool cmp(ban a,ban b){
if(a.sg!=b.sg) return a.sg>b.sg;
else return a.id<b.id;
}
int main(){
int a;
cin>>a;
ban b[a];
for(int c=0;c<a;c++){
cin>>b[c].name>>b[c].sg>>b[c].id;
}
sort(b,b+a,cmp);
cout<<b[0].name<<' '<<b[0].sg<<' '<<b[0].id;
return 0;
}