#include<iostream>
using namespace std;

int main()
{
    int n;
    int p[21] = {};

    cin >> n;

    int max = 0;
    for( int i = 1; i <= n; i++ )
    {
        int t;
        cin >> t >> p[t];
        if( max < p[t] )
            max = p[t];
    }
    
    int min = 1000;
    for( int i = 1; i <= 20; i++ )
    {
        if( p[i] == max && i < min )
            min = i;
    }

    cout << min << " " << max;

    return 0;
}
