#include <iostream>
#include <cstdlib>
#include <climits>

using namespace std;

int main () {
  int n;
  cin >> n;

  int maxv = INT_MIN;
  int winner = INT_MAX;
  for( int i = 0; i < n; i++ ) {
    int a, v;
    cin >> a >> v;
    if( maxv < v ) {
      winner = a;
      maxv = v;
    } else if( maxv == v ) {
      winner = min( a, winner );
    }
  }
  cout << winner << " " << maxv << endl;

  return EXIT_SUCCESS;
}