import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!T;r.popFront;}}

void main()
{
  int n; readV(n);
  int[] a; readA(n, a);

  a.sort();
  auto m = a[$-1], r = 0;
  foreach (i; 0..n-1)
    if ((m.to!real/2-a[i]).abs < (m.to!real/2-r).abs)
      r = a[i];

  writeln(m, " ", r);
}
