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

int n, a[1000000];

int main(){
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a+1, a+n+1);
    cout << a[n] << " ";
    int _min = 1e9, c;
    for (int i = 1; i < n; i++){
        if (abs(a[n]-2*a[i]) < _min){
            _min = abs(a[n]-2*a[i]);
            c = a[i];
        }
    }
    cout << c;
}