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

struct node {
    int id;
    int score;
    node(int i, int s) : id(i), score(s) { }
    bool operator <(const node &x) const {
        if(this->score != x.score) return this->score > x.score;
        return this->id < x.id;
    }
};

int main() {
    int n; cin >> n;
    vector<node> v;
    while(n--) {
        int id, score; cin >> id >> score;
        v.push_back(node(id, score));
    }
    node p = *min_element(v.begin(), v.end());
    cout << p.id << ' ' << p.score << endl;
}