using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
using ll = long long;
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define cYES cout << "YES" << endl
#define cNO cout << "NO" << endl
typedef long long int ll;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<vector<ll>> vvll;
typedef long double ld;
const int INF = 1 << 30;
const ll MOD = 1000000007;
int main()
{
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    Sort(a);
    bool jd=false;
    rep(i,n){
        if(a[i]==a[i+1]){
            jd=true;
            break;
        }
    }
    if(jd)cno;
    else cyes;
}
#include<bits/stdc++.h>
using namespace std;
int a[4],n,y,z,x[1001];
string s[1001],c;
int main(){
  cin>>n;
  for (int i=1;i<=n;i++){
    cin>>s[i]>>x[i];
    y=max(x[i],y);
  }
  for (int i=1;i<=n;i++)
    if (x[i]!=y&&x[i]>z) z=x[i],c=s[i];
  cout<<c;
}
