#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int n;
    cin >> n;

    vector<int> v(n);
    for(int i=0; i<n; ++i){
        int a;
        cin >> a;
        cin >> v[a-1];
    }

    vector<int>::iterator it = max_element(v.begin(), v.end());
    cout << (it - v.begin() + 1) << ' ' << *it << endl;

    return 0;
}