// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;
// cout << fixed << setprecision(桁数);

int main(){
    string S, T;
    cin >> S;
    reverse(all(S));
    for (int i = 0; i <= 10; i++)
    {
        bool flag = true;
        T = S;
        reverse(all(T));
        for (int j = 0; j < T.size(); j++){
            if(S[j] != T[j]){
                flag = false;
                break;
            }
        }
        if(flag){
            cout << "Yes" << endl;
            return 0;
        }

        S += '0';
    }

    cout << "No" << endl;
}
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);

#define endl '\n'

int main() { IO;
  int n;
  cin >> n;

  vector<pair<int, string>> v(n);
  for (auto& [h, name] : v) { cin >> name >> h; }
  sort(v.rbegin(), v.rend());
  cout << v[1].second << endl;

  return 0;
}
