#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int n,a[100001]; cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    cout<<a[n-1]<<" ";
    int k=0;
    while(2*a[k]<a[n-1]){
        k++;
    }
    if(abs(2*a[k-1]-a[n-1])>abs(2*a[k]-a[n-1])){
        cout<<a[k];
    }else{
        cout<<a[k-1];
    }
    return 0;
}
