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

struct wakasagi {
    int a, v;
    wakasagi(int A, int V) : a(A), v(V) {};
};

bool operator <(wakasagi A, wakasagi B) {
    if (A.v != B.v) return A.v < B.v;
    else return A.a > B.a;
}

int main()
{
    int n, a, v;
    cin >> n;
    vector<wakasagi> vec;
    for (int i = 0; i < n; ++i) {
        cin >> a >> v;
        vec.push_back(wakasagi(a, v));
    }
    vector<wakasagi>::iterator top =
        max_element(vec.begin(), vec.end());
    cout << top->a << " " << top->v << endl;
}