import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

void main() {
  int n;
  readf (" %d", &n);
  auto a = new int[n];
  foreach (t; 0 .. n) {
    readf (" %d", &a[t]);
  }
  sort (a);
  auto m = a[n-1];
  int best = -1;
  foreach (i; 0 .. n) {
    if ( abs (m - 2 * a[i]) < abs (m - 2 * best)) {
      best = a[i];
    }
  }
  writeln (m, " ", best);
}
