//Surf Smelt Fishing Contest
#include<bits/stdc++.h>
using namespace std;

vector<pair<int, int> > v;

bool comp(const pair<int, int> &a, const pair<int, int> &b){
  if(a.second==b.second)return a.first<b.first;
  return a.second>b.second;
}

int main(){
  int n;
  cin>>n;
  for(int i=0; i<n; i++){
    int a, b;
    cin>>a>>b;
    v.push_back(make_pair(a, b));
  }
  sort(v.begin(), v.end(), comp);
  cout<<v[0].first<<' '<<v[0].second<<endl;
  return 0;
}