#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

////////////////*My library*////////////////////////
#define rep_to(a,i,n) for(i=a;i<n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define rep_r(i,n) for(i=n-1;i>=0;i--)
#define debug_i(x) printf("x:%d\n",x)
#define debug_s(str) printf("str:%s\n",str)
#define debug_c(c) printf("c:%c\n",c)
#define s_i1(x) scanf("%d",&x)
#define s_i2(x,y) scanf("%d %d",&x,&y)
#define s_i3(x,y,z) scanf("%d %d %d",&x,&y,&z)
////////////////////////////////////////////////////
////////////////////////
/*prime()*/
/*primecount()*/
/*sort()*/
///////////////////////

int main()
{
	int i,j,k;
	int n,q;
	int x,y,sd_num=0;
	double max=0,num=0,sd_max=0;
	int a[100000]={},v[100000]={};

	s_i1(n);
	rep(i,n)
	{
		scanf("%d %d",&x,&y);
		//v[x]+=y;
		num=(max<y)? x : num;
		max=fmax(y,max);

		if(max==y)num=fmin(num,x);
	}
	printf("%d %d\n",(int)num,(int)max);
	return 0;
}