n=int(eval(input()))

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

N=a[-1]

x=0

for i in a:

 if abs(N/2-i)<abs(N/2-x):

  x=i

print((N,x))
n=int(eval(input()))

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

N=max(a)

x=0

for i in a:

 if abs(N/2-i)<abs(N/2-x):

  x=i

print((N,x))
n = int(eval(input()))
a = sorted(list(map(int, input().split())))
N = a[-1]
x = 0
for i in a:
    if abs(N / 2 - i) < abs(N / 2 - x):
        x = i
print((N, x))

n = int(eval(input()))
a = list(map(int, input().split()))
N = max(a)
x = 0
for i in a:
    if abs(N / 2 - i) < abs(N / 2 - x):
        x = i
print((N, x))

-a = sorted(list(map(int, input().split()))) -N = a[-1] +a = list(map(int, input().split())) +N = max(a)