#include <iostream>
using namespace std;

int main()
{
  int a[21], b[21];
  int n;
  int max = 0;
  int mx;
  cin >> n;
  for (int i = 1; i <= n; i++){
    cin >> a[i] >> b[i];
    if (b[i] >= max){
      max = b[i];
    }
  }
  int i = 0;
  while (1){
    if (b[i] == max){
      cout << mx << " " << max << endl;
      break;
    }
  }


  return 0;

}