#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59
using ld = long double;

bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}
int main()
{
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    cout << fixed << setprecision(6);

    int n;
    cin >> n;
    vector<pair<int, int>> vp;

    for (int i = 0; i < n; ++i)
    {
        int a, v;
        cin >> a >> v;
        vp.push_back({v, a});
    }
    sort(vp.rbegin(), vp.rend());

    if (n == 1)
    {
        cout << vp[0].second << " " << vp[0].first << endl;
    }
    else
    {
        int maxV = vp[0].first;
        int idx = vp[0].second;
        for (int i = 0; i < n; ++i)
        {
            if (maxV != vp[i].first)
            {
                break;
            }
            idx = vp[i].second;
        }
        cout << idx << " " << maxV << endl;
    }
    return 0;
}
