#include <iostream>

using namespace std;

int p[20];
int fish[20];

void bubble_sort_fish(int n){

  for( int i = 0 ; i < n - 1 ; i++ ){
    for( int j = n - 1 ; j > i ; j-- ){
      if( fish[j-1] > fish[j] ){

	int temp1 = fish[j];
	fish[j] = fish[j-1];
	fish[j-1] = temp1;

	int temp2 = p[j];
	p[j] = p[j-1];
	p[j-1] = temp2;

      }
    }
  }
}

int main(void){

  int n;

  cin >> n;
  for( int i = 0 ; i < n ; i++ ){
    cin >> p[i] >> fish[i];
  }

  bubble_sort_fish(n);//ただのバブルソートの練習、とくに意味はない。
  //  for( int i = 0 ; i < n; i++ )cout << p[i] << "---" << fish[i] << endl;
  //確認のアウトプット
  //以下がアルゴリズム
  int max_fish = 0;
  int min_p = 20;
  for( int i = n - 1 ; i >= 0 ; i-- ){
    if( max_fish < fish[i] && min_p > p[i] ){
      max_fish = fish[i];
      min_p = p[i];
    }
  }
  cout << min_p << " " << max_fish << endl;
}