n = int(eval(input()))

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

l.sort()

a = l[-1]

j = 0

while l[j] < int((a+1)/2):

    j += 1

else:

    if l[j] - int((a+1)/2) < int((a+1)/2) - l[j-1]:

        b = l[j]

    else:

        b = l[j-1]

print(("{} {}".format(a,b)))
N = int(eval(input()))

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

a.sort()

n = a[-1]

for i in range(N):

    if a[i]>=n/2:

        break



if n-a[i]>min(a[i-1],n-a[i-1]):

    r = a[i]

else:

    r = a[i-1]

print(('{} {}'.format(n,r)))
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
a = l[-1]
j = 0
while l[j] < int((a + 1) / 2):
    j += 1
else:
    if l[j] - int((a + 1) / 2) < int((a + 1) / 2) - l[j - 1]:
        b = l[j]
    else:
        b = l[j - 1]
print(("{} {}".format(a, b)))

N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
n = a[-1]
for i in range(N):
    if a[i] >= n / 2:
        break
if n - a[i] > min(a[i - 1], n - a[i - 1]):
    r = a[i]
else:
    r = a[i - 1]
print(("{} {}".format(n, r)))

-n = int(eval(input())) -l = list(map(int, input().split())) -l.sort() -a = l[-1] -j = 0 -while l[j] < int((a + 1) / 2): -    j += 1 +N = int(eval(input())) +a = list(map(int, input().split())) +a.sort() +n = a[-1] +for i in range(N): +    if a[i] >= n / 2: +        break +if n - a[i] > min(a[i - 1], n - a[i - 1]): +    r = a[i] -    if l[j] - int((a + 1) / 2) < int((a + 1) / 2) - l[j - 1]: -        b = l[j] -    else: -        b = l[j - 1] -print(("{} {}".format(a, b))) +    r = a[i - 1] +print(("{} {}".format(n, r)))