N = int(eval(input()))

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

A.sort()

def divisors(n):

    div = set()

    A = 1

    while A*A <= n:

        if n%A == 0:

            if A*A == n:

                div.add(A)

            else:

                B = n//A

                div.add(A)

                div.add(B)

        A += 1

    return div

div = list(divisors(A[0]) | divisors(A[1]))

m = 0

for x in div:

    count = 0

    for a in A:

        if a%x != 0:

            count += 1

        if count > 1:

            break

    if count <= 1:

        m = max(m, x)

print(m)
N = int(eval(input()))

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

A.sort()

def divisors(n):

    div = set()

    A = 1

    while A*A <= n:

        if n%A == 0:

            if A*A == n:

                div.add(A)

            else:

                B = n//A

                div.add(A)

                div.add(B)

        A += 1

    return div

div = list(divisors(A[0]) | divisors(A[1]))

div.sort(reverse=True)

for x in div:

    count = 0

    for a in A:

        if a%x != 0:

            count += 1

        if count > 1:

            break

    if count <= 1:

        print(x)

        break
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()


def divisors(n):
    div = set()
    A = 1
    while A * A <= n:
        if n % A == 0:
            if A * A == n:
                div.add(A)
            else:
                B = n // A
                div.add(A)
                div.add(B)
        A += 1
    return div


div = list(divisors(A[0]) | divisors(A[1]))
m = 0
for x in div:
    count = 0
    for a in A:
        if a % x != 0:
            count += 1
        if count > 1:
            break
    if count <= 1:
        m = max(m, x)
print(m)

N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()


def divisors(n):
    div = set()
    A = 1
    while A * A <= n:
        if n % A == 0:
            if A * A == n:
                div.add(A)
            else:
                B = n // A
                div.add(A)
                div.add(B)
        A += 1
    return div


div = list(divisors(A[0]) | divisors(A[1]))
div.sort(reverse=True)
for x in div:
    count = 0
    for a in A:
        if a % x != 0:
            count += 1
        if count > 1:
            break
    if count <= 1:
        print(x)
        break

-m = 0 +div.sort(reverse=True) -        m = max(m, x) -print(m) +        print(x) +        break