#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
#define MAX_N 20
using namespace std;
/*
struct Human {
    int no;
    int result;
};
 */
//typedef struct Human Human
typedef pair<int, int> Human;

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

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