#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define LL long long
using namespace std;
int n,a[1000001],max1=1e9,ans; 
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	int m=a[n];
	for(int i=1;i<=n;i++)
	{
		if(abs(a[i]*2-m)<max1) max1=abs(a[i]*2-m),ans=a[i];
	}
	printf("%d %d",a[n],ans);
	return 0;
} 