#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	int n,i,a[1000000],max=0,tmp=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		if(a[i]>max) max=a[i];
	}
	for(i = 0; i < n; i++){
        if(abs(max / 2 - tmp) > abs(max / 2 - a[i])){
            tmp = a[i];
        }
    }
    printf("%d %d\n",max,tmp);
	return 0;
}