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

int main() {
	int N, A[100010], X, Y = 1000000000;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A, A + N);
	X = A[N - 1];
	for (int i = 0; i < N - 1; i++) {
		if (abs(Y * 2 - X) > abs(A[i] * 2 - X)) {
			Y = A[i];
		}
	}
	cout << X << " " << Y << endl;
}