#include <iostream>
using namespace std;

int a[20], idx, mx;

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

    cout << idx << " " << mx << endl;

    return 0;
}