#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;
typedef pair<int,int> P;

bool cmp(const P& a,const P& b)
{
  if(a.first == b.first)
    return a.second < b.second;
  return a.first > b.first;
}

int main()
{
  int n;
  vector<P> vec;
  cin >> n;
  for(int i=0;i<n;i++)
    {
      int a,v;
      cin >> a >> v;
      vec.push_back(P(v,a));
    }
  sort(vec.begin(),vec.end(),cmp);
  cout << vec[0].second << " " << vec[0].first << endl;
  return 0;
}