import std.stdio, std.algorithm, std.range, std.conv, std.string, std.math;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln

void main() {
	int n;
	scanf("%d", &n);
	int[] a = new int[n];
	foreach (i; 0..n) scanf("%d", &a[i]);
	a.sort;
	int r = a[n-1], l = a[0];
	foreach (i; 0..n-1) {
		if (min(l,r-l) < min(a[i],r-a[i])) l = a[i];
	}
	writefln("%d %d", r, l);
}