#include <bits/stdc++.h>
#define inf 1000000000 //1E+9
#define mod 1000000007
using namespace std;

int main(){
	int n;cin>>n;
	int a[n];for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	cout<<a[n-1]<<" ";

	double M=double(a[n-1])/2.0;
	double m=inf;
	for(int i=0;i<n;i++){
		if(abs(M-double(a[i])) < m) m=abs(M-double(a[i]));
		else{cout<<a[i-1]<<endl;return 0;}
	}

	return 0;
}