#include    <iostream>
#include    <queue>
#include    <algorithm>

using namespace std;

int main() {
    using player = pair<int, int>;
    
    int n;
    priority_queue<player> score;
    
    cin >> n;

    for(int i = 0; i < n; i++) {
        int sc, num;
        cin >> num >> sc;
        score.push(make_pair(sc, -num));
    }

    cout << score.top().second * -1 << ' ' << score.top().first << endl;

    return 0;
}
