// 4 minuts
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < int(NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ll<<62)-1)
#define cINFINT ((1<<30)-1)

template <typename T>
void chmin(T& a, T b){ if(a > b) a = b; }
template <typename T>
void chmax(T& a, T b){ if(a < b) a = b; }


int main()
{
    cin.tie( 0 ); ios::sync_with_stdio( false );
    // ----------------------------------------------------------------
    
    ll n;
    cin>>n;
    priority_queue<pair<ll, string>> q;
    REP(i,n)
    {
        string s;
        ll t;
        cin>>s>>t;
        q.push({t,s});
    }
    q.pop();
    cout << q.top().second << endl;
    
    // ----------------------------------------------------------------
    return 0;
}
#include <iostream>

using namespace std;

int main()
{
    int n,k;
    long long res=0;
    cin>>n>>k;
    for (int i=1;i<=n;i++)
        for (int j=1;j<=k;j++)
    {
        res+=100*i+j;
    }
    cout<<res;
    return 0;
}
