#include<iostream>
#include<cstdio>
using namespace std;

int main(){
  int n,max=0,maxi=0,num,rec;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> num >> rec;
    if(rec>max){
      max=rec;
      maxi=num;
    } else if(rec==max){
      if(maxi>num){
	maxi=num;
      }
    }
  }
  cout << maxi << " " << max << endl;  
  return(0);
}