#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int n,a[100010],num;
int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	sort(a + 1, a + 1 + n);
	double ans = a[n] * 1.0 / 2;
	double mi = 10000000000;
	for(int i = 1; i <= n - 1; i++)
	{
		if(abs(a[i]-ans)<mi)
		{
			num = a[i];
			mi = abs(a[i] - ans);
		}
	}
	printf("%d %d\n", a[n], num);
	return 0;
}