n = int(eval(input()))

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



a.sort()



N = a[-1]

a.pop()



li = [abs(N/2 - k) for k in a]

index = li.index(min(li))



print(("{0} {1}".format(N, a[index])))

n = int(eval(input()))

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



N = max(a)

a.remove(N)

N2 = N/2



li = [abs(N2 - k) for k in a]

index = li.index(min(li))



print(("{0} {1}".format(N, a[index])))

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
N = a[-1]
a.pop()
li = [abs(N / 2 - k) for k in a]
index = li.index(min(li))
print(("{0} {1}".format(N, a[index])))

n = int(eval(input()))
a = list(map(int, input().split()))
N = max(a)
a.remove(N)
N2 = N / 2
li = [abs(N2 - k) for k in a]
index = li.index(min(li))
print(("{0} {1}".format(N, a[index])))

-a.sort() -N = a[-1] -a.pop() -li = [abs(N / 2 - k) for k in a] +N = max(a) +a.remove(N) +N2 = N / 2 +li = [abs(N2 - k) for k in a]