def gcd(a,b) :

    r = a % b

    if r == 0 :

        return b

    else :

        return gcd(b,r)



N = int(eval(input()))



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



L = [0] * N

R = [0] * N



for i in range(N) :  # iより左(右)

    if i == 0 :

        L[i] = A[i]

        R[-i-1] = A[-i-1]

    else :

        L[i] = gcd(L[i-1], A[i-1])

        R[-i-1] = gcd(R[-i],A[-i])



ans = 1



for i in range(N) :

    if i == 0 :

        new = R[i]

    elif i == N-1 :

        new = L[i]

    else :

        new = gcd(L[i],R[i])

    if ans < new :

        ans = new



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

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



def gcd(n, m):

    if m == 0:

        return n

    return gcd(m, n % m)



leftGcd = [-1] * (N + 1)

leftGcd[0] = A[0]



for i, a in enumerate(A, start=1):

    leftGcd[i] = gcd(leftGcd[i - 1], a)



rightGcd = [-1] * (N + 1)

rightGcd[-1] = A[-1]



for i, a in enumerate(reversed(A), start=1):

    rightGcd[-(i + 1)] = gcd(rightGcd[-i], a)



ans = max(rightGcd[1], leftGcd[-2])

for mid in range(1, N):

    ans = max(ans, gcd(leftGcd[mid], rightGcd[mid + 1]))



print(ans)
def gcd(a, b):
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)


N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * N
R = [0] * N
for i in range(N):  # iより左(右)
    if i == 0:
        L[i] = A[i]
        R[-i - 1] = A[-i - 1]
    else:
        L[i] = gcd(L[i - 1], A[i - 1])
        R[-i - 1] = gcd(R[-i], A[-i])
ans = 1
for i in range(N):
    if i == 0:
        new = R[i]
    elif i == N - 1:
        new = L[i]
    else:
        new = gcd(L[i], R[i])
    if ans < new:
        ans = new
print(ans)

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


def gcd(n, m):
    if m == 0:
        return n
    return gcd(m, n % m)


leftGcd = [-1] * (N + 1)
leftGcd[0] = A[0]
for i, a in enumerate(A, start=1):
    leftGcd[i] = gcd(leftGcd[i - 1], a)
rightGcd = [-1] * (N + 1)
rightGcd[-1] = A[-1]
for i, a in enumerate(reversed(A), start=1):
    rightGcd[-(i + 1)] = gcd(rightGcd[-i], a)
ans = max(rightGcd[1], leftGcd[-2])
for mid in range(1, N):
    ans = max(ans, gcd(leftGcd[mid], rightGcd[mid + 1]))
print(ans)

-def gcd(a, b): -    r = a % b -    if r == 0: -        return b -    else: -        return gcd(b, r) +N = int(eval(input())) +A = list(map(int, input().split())) -N = int(eval(input())) -A = list(map(int, input().split())) -L = [0] * N -R = [0] * N -for i in range(N):  # iより左(右) -    if i == 0: -        L[i] = A[i] -        R[-i - 1] = A[-i - 1] -    else: -        L[i] = gcd(L[i - 1], A[i - 1]) -        R[-i - 1] = gcd(R[-i], A[-i]) -ans = 1 -for i in range(N): -    if i == 0: -        new = R[i] -    elif i == N - 1: -        new = L[i] -    else: -        new = gcd(L[i], R[i]) -    if ans < new: -        ans = new +def gcd(n, m): +    if m == 0: +        return n +    return gcd(m, n % m) + + +leftGcd = [-1] * (N + 1) +leftGcd[0] = A[0] +for i, a in enumerate(A, start=1): +    leftGcd[i] = gcd(leftGcd[i - 1], a) +rightGcd = [-1] * (N + 1) +rightGcd[-1] = A[-1] +for i, a in enumerate(reversed(A), start=1): +    rightGcd[-(i + 1)] = gcd(rightGcd[-i], a) +ans = max(rightGcd[1], leftGcd[-2]) +for mid in range(1, N): +    ans = max(ans, gcd(leftGcd[mid], rightGcd[mid + 1]))