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

bool compare(pair<int,int> a, pair<int,int> b) {
	if(a.second == b.second )
		return a.first < b.first;
	else
		return a.second > b.second;
}

int main() {
	vector<pair<int,int> > in;
	int n;

	cin >> n;
	
	for(int i = 0; i < n; i++) {
		pair<int,int> tmp;
		cin >> tmp.first >> tmp.second;
		in.push_back(tmp);
	}

	sort(in.begin(), in.end(), compare);
	cout << in[0].first << " " << in[0].second << endl;

	return 0;
}