#include<cstdio>
#include<algorithm>
using namespace std;
struct num{
int x;
int y;
};
bool ans(num rhs, num lhs){
if (rhs.x > lhs.x){
return true;
}
else if (rhs.x == lhs.x&&rhs.y > lhs.y){
return true;
}
else{
return false;
}
}
int main(){
int n;
num op[1000];
while (scanf("%d", &n) != EOF){
for (int i = 0; i < n; i++){
scanf("%d %d", &op[i].x, &op[i].y);
}
sort(op, op + n,ans);
printf("%d %d\n", op[n - 1].x, op[n - 1].y);
}
}



京公网安备 11010502036488号