#include <iostream>
using namespace std;


int main()
{
    int n; cin >> n;
    int w, idx = 0, mx = 0;
    for(int i=0, index=0;i < n; ++i) {
        cin >> index >> w;
        if (mx < w) idx = index-1, mx = w;
    }

    cout << idx+1 << " " << mx << endl;

    return 0;
}