#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int,int> p;
 
int main(){
    vector<p> v;
    int n,data,num;
     
    cin >> n;
    for(int i = 0 ; i < n ; i++){
        cin >> num >> data;
        v.push_back(p(data,num));
       }
        sort(v.begin(),v.end());
	cout << v[n-1].second << ' ' << v[n-1].first << endl;
	return 0;
}