// #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, max = 0, ans = 0;
	int bangou = 0, num = 0;
	map<int, int> list;

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> bangou >> num;
		if (max < num){
			max = num;
			ans = bangou;
		}
		else if (max == num){
			if (bangou < ans)
				ans = bangou;
		}
	}
	cout << ans << " " << max << endl;

	return 0;
}