Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted.
n = int(input())
A = [int(a) for a in input().split()]

max_val = max(A)
mid_val = max_val - max_val//2



m = 0
for a in A:
    if abs(a - mid_val) > abs(m - mid_val):
        m = a
    # print("m: {}".format(m))

print("{} {}".format(max_val, m))

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

max_val = max(A)
mid_val = max_val - max_val//2



m = 0
for a in A:
    # print(abs(a - mid_val))
    # print(abs(m - mid_val))
    if abs(a - mid_val) < abs(m - mid_val):
        m = a
    # print("m: {}".format(m))

print("{} {}".format(max_val, m))
