#include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i = 0; i < (a); i++)
#define reps(i, a, b) for(int i = (a); i < (b); i++)
#define INF 1e9
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> pii;
int main() {
	int n;
	vector<pii> v;
	cin >> n;
	rep(i, n) {
		int ind, a;
		cin >> ind >> a;
		v.push_back(make_pair(ind,a));
	}
	sort(v.begin(), v.end(), [](pii a,pii b) -> bool {
			if(a.second == b.second) return a.first < b.first;
			return a.second > b.second;
			});
	cout << v[0].first << " " << v[0].second << endl;
	return 0;
}