#include<iostream>
using namespace std;

int main(){

  int n, a, v, m_a, m_v;

  cin >> n;

  m_v = 0;
  for(int i=0; i<n; i++){
    cin >> a >> v;

    if(v >= m_v){
      if(v == m_v && a > m_a) break;
      m_a = a;
      m_v = v;
    }
  }

  cout << m_a << " " << m_v << endl;

  return 0;

}