#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

typedef unsigned long long ull;
typedef std::pair<int,int> P;

bool compare(const P& lp, const P& rp){
    if(lp.second == rp.second){
        return lp.first > rp.first;
    }
    return lp.second < rp.second;
}

int main(){
    int N;
    std::cin >> N;

    std::vector<P> V;
    REP(i, N){
        int a, v;
        std::cin >> a >> v;
        V.push_back({a, v});
    }

    std::sort(V.rbegin(), V.rend(), compare);

    std::cout << V[0].first << " " << V[0].second << std::endl;
}