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

typedef pair<int, int> P;

int main(){
    int n;
    cin >> n;
    int m_a , m_v = 0, a, v;
    for(int i = 0; i < n; i++){
        cin >> a >> v;
        if( v > m_v || (v == m_v && a < m_a )){
            m_v = v;
            m_a = a;
        }
    }
    cout << m_a << ' ' << m_v << endl;
    return 0;
}