// D - Binomial Coefficients
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)

int  A[100000];

int main(){
	int N; cin>>N;
	int r = 0, n = 0;
	rep(i, N){ cin>>A[i]; n = max(n, A[i]); }
	int half = n/2;
	rep(i, N) if(abs(half - r) > abs(half - A[i])) r = A[i];
	cout<< n <<" "<< r <<endl;
}