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

int main() {
    int n; cin >> n;
    vector<pair<int, int> > vec;
    while(n--) {
        int a, v; cin >> a >> v;
        vec.push_back(make_pair(v, a));
    }
    auto p = *max_element(begin(vec), end(vec), [](pair<int, int> x, pair<int, int> y) { return x.first != y.first ? x.first > y.first : x.second < y.second; });
    cout << p.second << ' ' << p.first << endl;
}