#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

typedef pair<int, int> P;

bool compare(P v1, P v2){
  if(v1.second > v2.second) return true;
  else if(v1.second < v2.second) return false;
  else{
    if(v1.first < v2.first) return true;
    else return false;
  }
}
  
int main(){
  vector<P> v;
  int n;
  cin >> n;
  P t;
  for(int i = 0 ; i < n ; i++){
    cin >> t.first >> t.second;
    v.push_back(t);
  }

  sort(v.begin(), v.end(), compare);
  
  cout << v[0].first << ' ' << v[0].second << endl;
  return 0;
}