n=int(eval(input()))

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

if len(box)==2:print((max(box),min(box)));exit()

max_box=max(box)

target=max_box//2

if max_box%2==0:

    if target not in box:

        box.append(target)

        box=sorted(box)

        add=box.index(target)

        if abs(target-box[add-1])>abs(target-box[add+1]):

            print((max_box,box[add+1]))

        else:

            print((max_box,box[add-1]))

    else:print((max_box,target))

else:

    if (target+1 not in box) and (target not in box):

        box.append(target)

        box=sorted(box)

        add=box.index(target)

        if abs(target-box[add-1])>abs(target+1-box[add+1]):

            print((max_box,box[add+1]))

        else:print((max_box,box[add-1]))

    else:

        if target in box:print((max_box,target))

        else:print((max_box,target+1))
n=int(eval(input()))

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

right=box.pop()

point=right//2



ans=0

left=10**9

for i in box:

    if abs(i-point)<=left:

        left=abs(i-point)

        ans=i

        if ans==point or ans==point+1:

            print((right,ans))

            exit()

print((right,ans))
n = int(eval(input()))
box = sorted(list(map(int, input().split())))
if len(box) == 2:
    print((max(box), min(box)))
    exit()
max_box = max(box)
target = max_box // 2
if max_box % 2 == 0:
    if target not in box:
        box.append(target)
        box = sorted(box)
        add = box.index(target)
        if abs(target - box[add - 1]) > abs(target - box[add + 1]):
            print((max_box, box[add + 1]))
        else:
            print((max_box, box[add - 1]))
    else:
        print((max_box, target))
else:
    if (target + 1 not in box) and (target not in box):
        box.append(target)
        box = sorted(box)
        add = box.index(target)
        if abs(target - box[add - 1]) > abs(target + 1 - box[add + 1]):
            print((max_box, box[add + 1]))
        else:
            print((max_box, box[add - 1]))
    else:
        if target in box:
            print((max_box, target))
        else:
            print((max_box, target + 1))

n = int(eval(input()))
box = sorted(list(map(int, input().split())))
right = box.pop()
point = right // 2
ans = 0
left = 10**9
for i in box:
    if abs(i - point) <= left:
        left = abs(i - point)
        ans = i
        if ans == point or ans == point + 1:
            print((right, ans))
            exit()
print((right, ans))

-if len(box) == 2: -    print((max(box), min(box))) -    exit() -max_box = max(box) -target = max_box // 2 -if max_box % 2 == 0: -    if target not in box: -        box.append(target) -        box = sorted(box) -        add = box.index(target) -        if abs(target - box[add - 1]) > abs(target - box[add + 1]): -            print((max_box, box[add + 1])) -        else: -            print((max_box, box[add - 1])) -    else: -        print((max_box, target)) -else: -    if (target + 1 not in box) and (target not in box): -        box.append(target) -        box = sorted(box) -        add = box.index(target) -        if abs(target - box[add - 1]) > abs(target + 1 - box[add + 1]): -            print((max_box, box[add + 1])) -        else: -            print((max_box, box[add - 1])) -    else: -        if target in box: -            print((max_box, target)) -        else: -            print((max_box, target + 1)) +right = box.pop() +point = right // 2 +ans = 0 +left = 10**9 +for i in box: +    if abs(i - point) <= left: +        left = abs(i - point) +        ans = i +        if ans == point or ans == point + 1: +            print((right, ans)) +            exit() +print((right, ans))