#include<iostream>
using namespace std;
int main(){
  int a[20],v[20],max=0,number,n;
  cin >>n;
  for(int i=0;i<n;i++){
    cin >>a[i]>>v[i];
    
    if(max<v[i]){
      max=v[i];
      number=i;}
  else if(max==v[i] && a[i]<a[number]){
    max=v[i];
    number=i;}
  }
    cout <<a[number]<<" "<<v[number]<<endl;
    return 0;
  }