import sys

import bisect



sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

    n = int(eval(input()))

    A = sorted(list(map(int, input().split())))

    if n == 2:

        print((*A[::-1]))

        exit()



    idx = bisect.bisect_left(A, A[-1] // 2)

    if abs(A[-1] - A[idx] - A[-1] // 2) > abs(A[-1] - A[idx - 1] - A[-1] // 2):

        idx -= 1



    print((A[-1], A[idx]))





if __name__ == '__main__':

    resolve()

import sys



sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 998244353





def resolve():

    n = int(eval(input()))

    A = sorted(list(map(int, input().split())))



    MAX_V = A[-1]

    target = MAX_V // 2 if MAX_V % 2 == 0 else (MAX_V + 1) // 2



    diff = f_inf

    res = A[0]

    for i in range(n - 1):

        if abs(target - A[i]) < diff:

            diff = abs(target - A[i])

            res = A[i]

    print((MAX_V, res))





if __name__ == '__main__':

    resolve()

import sys
import bisect

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    n = int(eval(input()))
    A = sorted(list(map(int, input().split())))
    if n == 2:
        print((*A[::-1]))
        exit()
    idx = bisect.bisect_left(A, A[-1] // 2)
    if abs(A[-1] - A[idx] - A[-1] // 2) > abs(A[-1] - A[idx - 1] - A[-1] // 2):
        idx -= 1
    print((A[-1], A[idx]))


if __name__ == "__main__":
    resolve()

import sys

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 998244353


def resolve():
    n = int(eval(input()))
    A = sorted(list(map(int, input().split())))
    MAX_V = A[-1]
    target = MAX_V // 2 if MAX_V % 2 == 0 else (MAX_V + 1) // 2
    diff = f_inf
    res = A[0]
    for i in range(n - 1):
        if abs(target - A[i]) < diff:
            diff = abs(target - A[i])
            res = A[i]
    print((MAX_V, res))


if __name__ == "__main__":
    resolve()

-import bisect -mod = 10**9 + 7 +mod = 998244353 -    if n == 2: -        print((*A[::-1])) -        exit() -    idx = bisect.bisect_left(A, A[-1] // 2) -    if abs(A[-1] - A[idx] - A[-1] // 2) > abs(A[-1] - A[idx - 1] - A[-1] // 2): -        idx -= 1 -    print((A[-1], A[idx])) +    MAX_V = A[-1] +    target = MAX_V // 2 if MAX_V % 2 == 0 else (MAX_V + 1) // 2 +    diff = f_inf +    res = A[0] +    for i in range(n - 1): +        if abs(target - A[i]) < diff: +            diff = abs(target - A[i]) +            res = A[i] +    print((MAX_V, res))