# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <unordered_map>

using namespace std;
using LL = long long;

constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;

bool calc(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() {
	int n;
	int a, v;
	vector<pair<int, int>> W;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a >> v;
		W.emplace_back(a, v);
	}
	sort(W.begin(), W.end(), calc);
	cout << W[0].first << " " << W[0].second << endl;
}