#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
double N;
ll M;
string s;
vector<ll > input1;  
vector<vector <ll > > input2;

int main(){
    
    int n = 0;
    cin >> n;
    vector<pair <int, int > > result;
    int s, t; 
    for(int i = 0; i < n; i++){
        cin >> s >> t;
        result.push_back(make_pair(t, s));
    }

    sort(result.rbegin(), result.rend());

    int temp = result[0].first;
    int number = result[0].second;
    for(int i = 0; i < n; i++){
        if(temp == result[i].first){
            number = result[i].second;
        }else{
            break;
        }
    }

    cout << number <<  " " << result[0].first << endl;



} 
