#include <cstdio>
using namespace std;
int main(){
    int n, a, b, maxv, maxi;
    scanf("%d", &n);
    maxv = -1, maxi = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &a, &b);
        if (b > maxv) { maxv = b; maxi = a; }
        if (b == maxv && maxi > a) maxi = a;
    }
    printf("%d %d\n", maxi, maxv);
    return 0;
}


