#include <iostream>
using namespace std;

int main(void){
  int n,num,w,takata,vic = 0;
  int p[20] = {0};

  cin >> n;
  for(int i = 0 ; i < n ; i++){
    cin >> num >> w;
    p[num-1] = w;  
  }

  takata = p[0];
  for(int i = 1 ; i < n ; i++){
    if(takata < p[i]){
      takata = p[i];
      vic = i;
    } 
  }
  vic++;
  cout << vic << ' ' << takata << endl;

  return 0;
}