#include <iostream>

using namespace std;

int info[22];

int main()
{
    int n, a, v;
    int max_idx = 0;

    cin >> n;
    
    info[max_idx] = -10;
    for (int i = 0; i < n; i++) {
        cin >> a >> v;
        info[a] = v;
    }
    
    for (int i = 1; i <= n; i++)
        if (info[max_idx] < info[i])
            max_idx = i;
    cout << max_idx << " " << info[max_idx] << endl;
    
    return 0;
}