#include <stdio.h>
#include <stdlib.h>
typedef struct nums{
    int x;
    int y;
}NUMS;
int cmp(const void*a,const void*b){
    if(((NUMS *)a)->x == ((NUMS *)b)->x){
        return ((NUMS *)a)->y > ((NUMS *)b)->y;
    }
    return ((NUMS *)a)->x > ((NUMS *)b)->x;
}
int main() {
    int n;
    while (scanf("%d", &n) != EOF) { // 注意 while 处理多个 case
        NUMS arr[n];
        for(int i=0;i<n;++i){
            scanf("%d %d",&arr[i].x, &arr[i].y);
        }
        qsort(arr,n,sizeof(NUMS),cmp);
        printf("%d %d",arr[0].x,arr[0].y);
    }
    return 0;
}