#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

struct P{
    int num;
    int fish;
    static bool more(const P& left,const P& right){
        return left.fish > right.fish;
    }
    static bool numless(const P& left,const P& right){
        return left.num < right.num;
    }
};

int main(){
    int n;
    cin >> n;
    vector <P> data;
    P ls[n];
    for(int i=0;i<n;i++){
        cin >> ls[i].num >> ls[i].fish;
        data.push_back(ls[i]);
    }
    sort(data.begin(),data.end(),P::numless);
    sort(data.begin(),data.end(),P::more);
    cout << data[0].num << " " << data[0].fish << endl;
}