#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
struct city
{
string s;
int t;
}a[105];
bool cmp(city x, city y)
{
return x.t < y.t;
}
int main()
{
int cur = 1;
while(cin >> a[cur].s >> a[cur].t)
{
cur++;
}
cur--;
sort(a + 1, a + cur + 1, cmp);
cout << a[1].s << endl;
return 0;
}