from operator import mul

from functools import reduce



def cmb(n, r):

    r = min(n - r, r)

    if r == 0:

        return 1

    numer = reduce(mul, list(range(n, n - r, -1)))

    denom = reduce(mul, list(range(1, r + 1)))

    return numer // denom





n = int(eval(input()))

a = list(map(int, input().split()))

ai = max(a)

diff = float("inf")

for aj in set(a):

    if abs(ai / 2 - aj) < diff:

        ans = [ai, aj]

        diff = abs(ai / 2 - aj)

print((' '.join(map(str, ans))))

n = int(eval(input()))

a = list(map(int, input().split()))

ai = max(a)

diff = float("inf")

for aj in set(a):

    if abs(ai / 2 - aj) < diff:

        ans = [ai, aj]

        diff = abs(ai / 2 - aj)

print((' '.join(map(str, ans))))

from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n - r, r)
    if r == 0:
        return 1
    numer = reduce(mul, list(range(n, n - r, -1)))
    denom = reduce(mul, list(range(1, r + 1)))
    return numer // denom


n = int(eval(input()))
a = list(map(int, input().split()))
ai = max(a)
diff = float("inf")
for aj in set(a):
    if abs(ai / 2 - aj) < diff:
        ans = [ai, aj]
        diff = abs(ai / 2 - aj)
print((" ".join(map(str, ans))))

n = int(eval(input()))
a = list(map(int, input().split()))
ai = max(a)
diff = float("inf")
for aj in set(a):
    if abs(ai / 2 - aj) < diff:
        ans = [ai, aj]
        diff = abs(ai / 2 - aj)
print((" ".join(map(str, ans))))

-from operator import mul -from functools import reduce - - -def cmb(n, r): -    r = min(n - r, r) -    if r == 0: -        return 1 -    numer = reduce(mul, list(range(n, n - r, -1))) -    denom = reduce(mul, list(range(1, r + 1))) -    return numer // denom - -