module AOJ_Volume0095;

import std.stdio,std.string,std.conv,std.array,std.algorithm;

int main()
{
	int n = readln.chomp.to!int;
	int ans = 0;
	int res[21][2];
	foreach(i;0..n)
	{
		string[] s = readln.chomp.split(" ");
		int a = s[0].to!int;
		int v = s[1].to!int;
		res[i][0] = a;
		res[i][1] = v;
		ans = max(ans,v);
	}

	foreach(i;0..n)
	{
		if(ans == res[i][1])
		{
			writeln(i+1," ",ans);
			return 0;
		}
	}
	return 0;
}