// #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>	// istringstream
using namespace std;

int main(){
	int n, ansBangou = 0, maxNum = -1;
	int bangou = 0, num = -1;

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> bangou >> num;
		if (maxNum < num){
			maxNum = num;
			ansBangou = bangou;
		}
		else if (maxNum == num){
			ansBangou = min(ansBangou, bangou);
		}
	}
	cout << ansBangou << " " << maxNum << endl;

	return 0;
}