#include <bits/stdc++.h>
using namespace std;

struct Human {
    int no;
    int point;
};

int compareTo(const Human& h1, const Human& h2) {
    if(h1.point > h2.point) return(1);
    else if(h2.point > h1.point) return(0);
    
    if(h1.no < h2.no) return(1);
    else  return(0);
}

int main(void) {
    int n; scanf("%d", &n);
    Human player[n];
    for(int r = 0; r < n; r++) {
        scanf("%d %d", &player[r].no, &player[r].point);
    }
    sort(player, player+n, compareTo);
    printf("%d %d\n", player[0].no, player[0].point);
    return(0);
}