#include <bits/stdc++.h>
using namespace std;

const int nm = 1e5;
int n;
int a[nm];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int idx = 0;
	for (int i = 0; i < n - 1; i++)
		if (abs(a[i] * 2 - a[n - 1]) < abs(a[idx] * 2 - a[n - 1]))
			idx = i;
	cout << a[n - 1] << " " << a[idx] << endl;
}
