#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
  int n;
  cin >> n;
  map<int, int> point;
  vector<int> tmp(n);
  for(int i = 0; i < n; i++){
    int a, v;
    cin >> a >> v;
    point[a] = v;
    tmp[i] = v;
  }
  sort(tmp.begin(), tmp.end(), greater<int>());
  for(int i = 1; i <= n; i++){
    if(point[i] == tmp[0]){
      cout << i << " " << point[i] << endl;
      return 0;
    }
  }
}