n=int(eval(input()))

a=[int(i) for i in input().split()]

a.sort()

enu=max(a)



k=(enu)/2

sa=10000000000000000000000000000



for i in range(n-1):

    if abs(k-a[i])<sa:

        sa=k-a[i]

        aru=a[i]



print((enu,aru))
n=int(eval(input()))

a=[int(i) for i in input().split()]

 

enu=max(a)

 

k=(enu)/2

sa=float("inf")

 

for i in range(n):

    if abs(k-a[i])<sa and a[i]!=enu:

        sa=abs(k-a[i])

        aru=a[i]

 

print((enu,aru))
n = int(eval(input()))
a = [int(i) for i in input().split()]
a.sort()
enu = max(a)
k = (enu) / 2
sa = 10000000000000000000000000000
for i in range(n - 1):
    if abs(k - a[i]) < sa:
        sa = k - a[i]
        aru = a[i]
print((enu, aru))

n = int(eval(input()))
a = [int(i) for i in input().split()]
enu = max(a)
k = (enu) / 2
sa = float("inf")
for i in range(n):
    if abs(k - a[i]) < sa and a[i] != enu:
        sa = abs(k - a[i])
        aru = a[i]
print((enu, aru))

-a.sort() -sa = 10000000000000000000000000000 -for i in range(n - 1): -    if abs(k - a[i]) < sa: -        sa = k - a[i] +sa = float("inf") +for i in range(n): +    if abs(k - a[i]) < sa and a[i] != enu: +        sa = abs(k - a[i])