N = int(eval(input()))

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

maxA = max(A)

half = maxA/2

t = 10000000000

for i in range(N):

    if A[i] != maxA and abs(A[i]-half) < abs(t-half):

        t = A[i]

print((maxA,t))
N = int(eval(input()))

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



maxA = max(A)

half = maxA/2

diff = 10**10

ans = 0

for i in range(N):

    if A[i] != maxA and abs(A[i]-half) < diff:

        diff = abs(A[i]-half)

        ans = A[i]



print((maxA, ans))
N = int(eval(input()))
A = list(map(int, input().split()))
maxA = max(A)
half = maxA / 2
t = 10000000000
for i in range(N):
    if A[i] != maxA and abs(A[i] - half) < abs(t - half):
        t = A[i]
print((maxA, t))

N = int(eval(input()))
A = list(map(int, input().split()))
maxA = max(A)
half = maxA / 2
diff = 10**10
ans = 0
for i in range(N):
    if A[i] != maxA and abs(A[i] - half) < diff:
        diff = abs(A[i] - half)
        ans = A[i]
print((maxA, ans))

-t = 10000000000 +diff = 10**10 +ans = 0 -    if A[i] != maxA and abs(A[i] - half) < abs(t - half): -        t = A[i] -print((maxA, t)) +    if A[i] != maxA and abs(A[i] - half) < diff: +        diff = abs(A[i] - half) +        ans = A[i] +print((maxA, ans))