#include<iostream>
#include<vector>
using namespace std;

int main(){
	int n; cin >> n;
	vector<int> a(n);
	int amax=0;
	for(int i=0;i<n;i++) {
		cin >> a[i];
		amax=max(amax,a[i]);
	}
	int center=0;
	for(int i=0;i<n;i++) {
		if(abs(amax/2-a[i])<abs(amax/2-center)) center=a[i];
	}
	cout << amax << " " << center << endl;
}
