#include<iostream>
using namespace std;

int main()
{
    int n;
    int g[20] = {}, p[20] = {};

    cin >> n;

    for( int i = 0; i < n; i++ )
        cin >> g[i] >> p[i];

    int max = -1;    
    for( int i = 0; i < 20; i++ )
    {
        if( max < p[i] )
            max = p[i];
    }

    int min = 1000;
    for( int i = 0; i < 20; i++ )
    {
        if( p[i] == max )
        {
            if( min > g[i] )
                min = g[i];
        }
    }

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

    return 0;
}

