#include<iostream>
using namespace std;

int main()
{
    int number,score,n;
    int winnerNumber,winnerScore = -1;

    cin >> n;

    for(int i=0; i<n; i++){
        cin >> number >> score;

        if(score > winnerScore ){
            winnerScore = score;
            winnerNumber = number;
            continue;
        }
        if(score == winnerScore && number < winnerNumber){
            winnerScore = score;
            winnerNumber = number;
        }
    }

    cout << winnerNumber << ' ' << winnerScore << endl;

    return 0;
}