#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    int max_ = -1, id;
    int a, v;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> a >> v;
        if(max_ < v){
            max_ = v;
            id = a;
        } else if(max_ == v && id > a){
            id = a;
        }
    }
    
    cout << id << ' ' << max_ << endl;
}