import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	auto n = readln.chomp.to!int;
	int[2] ans;
	while (n--) {
		auto x = readln.split.map!(to!int);
		if (ans[1] < x[1]) {
			ans = x.array;
		} else if (ans[1] == x[1] && ans[0] > x[1]) {
			ans = x.array;
		}
	}
	writeln(ans[0], " ", ans[1]);
}