import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "begin", long, "end");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    auto a = aryread();
    a.sort();
    auto m = a[n - 1];
    long ok = -1, ng = n;
    while (abs(ok - ng) > 1)
    {
        long mid = (ok + ng) / 2;
        if (a[mid] < m / 2)
            ok = mid;
        else
            ng = mid;
    }
    long ans;
    // この時点ではokは半分を超えないもののうちで最大
    // 半分を超えるものの最小のが大きい場合もあるかもしれない…
    if (ok < 0)
        ans = a[0];
    else
    {
        if (m / 2 - a[ok] < m / 2 - a[ok + 1] || a[ok + 1] == m)
            ans = a[ok];
        else
            ans = a[ok + 1];
    }
    writefln("%s %s", m, ans);
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}
