#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    int n;
    cin >> n;
    int A = 0, V = -1;
    for(int i = 0; i < n; i++){
        int a, v;
        cin >> a >> v;
        if(v > V){
            A = a;
            V = v;
        }
        if(v == V && a < A){
            A = a;
            V = v;
        }
    }
    cout << A << " " << V << endl;

    return 0;
}
