import std.stdio,
       std.string,
       std.conv,
       std.math,
       std.algorithm;

void main() {
  int N = readln.chomp.to!(int);
  long[] a = readln.chomp.split.to!(long[]);
  sort(a);

  long n = a[a.length - 1];
  long r, diff = long.max;

  foreach (long e; a[0..(a.length - 1)]) {
    if (diff > abs(n - e * 2)) {
      diff = abs(n - e * 2);
      r = e;
    }
  }

  writeln(n, " ", r);
}
