def main():

    n = int(eval(input()))

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

    A.sort()

    m = A.pop()

    B = [[a, abs(a - (m / 2))] for a in A]

    B.sort(key = lambda x: x[1])

    print(('{} {}'. format(m, B[0][0])))



if __name__ == '__main__':

    main()

def main():

    n = int(eval(input()))

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

    A.sort()

    ans = [str((m := A.pop())), ]

    m /= 2

    A = [(a, abs(a - m)) for a in A]

    A.sort(key = lambda x: x[1])

    ans.append(str(A[0][0]))

    print((' '.join(ans)))



if __name__ == '__main__':

    main()

def main():
    n = int(eval(input()))
    A = list(map(int, input().split()))
    A.sort()
    m = A.pop()
    B = [[a, abs(a - (m / 2))] for a in A]
    B.sort(key=lambda x: x[1])
    print(("{} {}".format(m, B[0][0])))


if __name__ == "__main__":
    main()

def main():
    n = int(eval(input()))
    A = list(map(int, input().split()))
    A.sort()
    ans = [
        str((m := A.pop())),
    ]
    m /= 2
    A = [(a, abs(a - m)) for a in A]
    A.sort(key=lambda x: x[1])
    ans.append(str(A[0][0]))
    print((" ".join(ans)))


if __name__ == "__main__":
    main()

-    m = A.pop() -    B = [[a, abs(a - (m / 2))] for a in A] -    B.sort(key=lambda x: x[1]) -    print(("{} {}".format(m, B[0][0]))) +    ans = [ +        str((m := A.pop())), +    ] +    m /= 2 +    A = [(a, abs(a - m)) for a in A] +    A.sort(key=lambda x: x[1]) +    ans.append(str(A[0][0])) +    print((" ".join(ans)))