#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <unordered_map>
#define Debug 0
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

//最大公約数
template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//最小公倍数
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

vector<pair<int, int>> pa;
int main(){
    int N; cin >> N;
    int ma = 0;
    int ma_i = 1000;
    for (int i = 0; i < N; i++) {
        int a, b; cin >> a >> b;
        pa.push_back({a, b});
        if (b > ma) ma = b;
    }
    for (auto i: pa) {
        if (i.second == ma) {
            if (ma_i > i.first) ma_i = i.first;
        }
    }
    for (auto i: pa) {
        if (i.first == ma_i) {
            cout << i.first << " " << i.second << endl;
            break;
        }
    }

}



