#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
using namespace std;

struct Human {
    int no;
    int result;
};
typedef struct Human Human;

int compareTo(const Human& a, const Human& b) {
    return(a.result > b.result);
}

int main(void) {
    int num; cin >> num;
    Human table[num];
    for(int r = 0; r < num; r++) cin >> table[r].no >> table[r].result;
    sort(table, table+num, compareTo);
    
    int minNo = INT_MAX, minResult = INT_MAX;
    int topResult = table[0].result;
    for(int r = 0; r < num && (table[r].result == topResult); r++) {
        if(table[r].no < minNo) {
            minNo = table[r].no; minResult = table[r].result;
        }
    }
    cout << minNo << " " << minResult << endl;
    return(0);
}