#include <iostream>
using namespace std;

int main() {
    int n; cin >> n;

    int most_fish = -1, most_people = 0;
    for(int i = 0; i < n; i++) {
        int a, v;
        cin >> a >> v;
        if (most_fish < v) {
            most_fish = v;
            most_people = a;
        } else if (most_fish == v && most_people > a) {
            most_people = a;
        }
    }
    cout << most_people  << " " << most_fish << endl;
}

