#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n, r[2];
    int max = 0, num = 20;
    cin >> n;
    rep(i,n){
        cin >> r[0] >> r[1];
        if(max < r[1]){
            max = r[1];
            num = r[0];
        }else if(max == r[1] && num > r[0]){
            num = r[0];
        }
    }
    cout << num << ' ' << max << endl;
}