#include<iostream>
#include<algorithm>
using namespace std;

int main(){
  int n,tmp,temp,cou=0;
  int i,j;
  int a[20],v[100];
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a[i] >> v[i];
  }
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      if(v[i] < v[j]){
	temp = v[i];
	v[i] = v[j];
	v[j] = temp;
	tmp = a[i];
	a[i] = a[j];
	a[j] = tmp;
      }
    }
  }
  tmp = v[i];
  for(i=1;i<n;i++){
    if(tmp == v[i]){
      cou++;
    }
  }
  if(cou != 0){
    sort(a,a+cou);
  }
  cout << a[0] << " " << v[0] << endl;
}