include <iostream>
using namespace std;

int main(void){

  int n;
  int max = 0;
  int num = 0;
  int flag = 0;

  cin >> n;

  for( int i = 0 ; i < n ; i++ ){

    int a = 0,v = 0;

    cin >> a >> v;

    if( max <= v && flag == 0){
      
      max = v;
      num = a;

      if( v == 0 ) flag = 1;

    }

  }

  cout << num << " " << max << endl;

  return 0;

}