#include <iostream>

using namespace std;

int main()
{
    int n, a, v, a_res=21, v_res=0;
    while(cin>>n) {
        while(n--) {
            cin >> a >> v;
            if ((v_res == v && a_res > a) || (v_res < v)) {
                a_res = a;
                v_res = v;
            } 
        }
        cout << a_res << " " << v_res << endl;
    }
    return 0;
}