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

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