#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
int a[100010];
int main(){
	int n;
	cin>>n;
	for(int i = 1;i <= n; i++) 	cin>>a[i];
	sort(a + 1,a + n + 1);
	cout<<a[n]<<" ";
	int m = a[1];
	double mid = double(a[n])/2.0;
	for(int i = 2;i <= n; i++)
	if(abs(double(m) - mid) > abs(double(a[i]) - mid)) 
	  m = a[i];
	cout<<m<<endl;
	return 0;
}