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

    a.sort!"a > b";
    long amax = a[0];
    a.popFront;
    long ahalf = long.max / 2;
    foreach (x; a)
    {
        if (abs(x-amax/2) < abs(ahalf-amax/2)) ahalf = x;
    }

    writeln(amax, " ", ahalf);
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;