#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	int n,p,w;
	cin >> n;
	int max = -1;
	int maxp = -1;
	for(int i=0;i<n;i++){
		cin >> p;
		cin >> w;
		if(max < w){
			maxp = p;
			max = w;
		}
	}
		cout << maxp << " " << max << endl;
		
		return 0;
}