N = int(eval(input()))

a = sorted(int(x) for x in input().split())



def hoge(n, r):

 return n * (min(n-r, r))



n = max(a)

ans = (n, a[0])

for i in a[1:]:

 ans = (n, i) if hoge(*ans) < hoge(n, i) else ans

print((*ans))
N = int(eval(input()))

a = tuple(int(x) for x in input().split())



def hoge(n, r):

 return n * (min(n-r, r))



n = max(a)

ans = (n, a[0]) if n != a[0] else (n, a[1])

for i in a:

 if n == i: continue

 ans = (n, i) if hoge(*ans) < hoge(n, i) else ans

print((*ans))

N = int(eval(input()))
a = sorted(int(x) for x in input().split())


def hoge(n, r):
    return n * (min(n - r, r))


n = max(a)
ans = (n, a[0])
for i in a[1:]:
    ans = (n, i) if hoge(*ans) < hoge(n, i) else ans
print((*ans))

N = int(eval(input()))
a = tuple(int(x) for x in input().split())


def hoge(n, r):
    return n * (min(n - r, r))


n = max(a)
ans = (n, a[0]) if n != a[0] else (n, a[1])
for i in a:
    if n == i:
        continue
    ans = (n, i) if hoge(*ans) < hoge(n, i) else ans
print((*ans))

-a = sorted(int(x) for x in input().split()) +a = tuple(int(x) for x in input().split()) -ans = (n, a[0]) -for i in a[1:]: +ans = (n, a[0]) if n != a[0] else (n, a[1]) +for i in a: +    if n == i: +        continue