N = int(eval(input()))

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





def gcd(a,b):

  x = max([a,b])

  y = min([a,b])

  while y:

    x, y = y, x % y

  return x



L = [0]

R = [0]



for i in range(N):

    L.append(gcd(L[-1], A[i]))

    

for i in reversed(list(range(N))):

    R.append(gcd(R[-1], A[i]))



R = list(reversed(R))





ans = 1

for i in range(N-1):

    ans = max(ans, gcd(L[i], R[i+1]))



# 上のループだと、左端を除いたパターンと右端を除いたパターンが含まれないのでここで考慮に入れる

ans = max(ans, R[1])

ans = max(ans, L[-2])



print(ans)

#print(R)

#print(L)




N = int(eval(input()))

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



from fractions import gcd

def lcm(x, y):

    return x * y // gcd(x, y)



gcds = [0] * N

gcds[0] = A[0]

rev_gcds = [0] * N

rev_gcds[-1] = A[-1]



for i in range(1, N):

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

    rev_gcds[N-1-i] = gcd(A[N-1-i],  rev_gcds[N-i])



ans = 1

for i in range(N):

    if i == 0:

        tmp = rev_gcds[i+1]

    elif i == N-1:

        tmp = gcds[i-1]

    else:

        tmp = gcd(gcds[i-1], rev_gcds[i+1])

    ans = max(ans, tmp)



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


def gcd(a, b):
    x = max([a, b])
    y = min([a, b])
    while y:
        x, y = y, x % y
    return x


L = [0]
R = [0]
for i in range(N):
    L.append(gcd(L[-1], A[i]))
for i in reversed(list(range(N))):
    R.append(gcd(R[-1], A[i]))
R = list(reversed(R))
ans = 1
for i in range(N - 1):
    ans = max(ans, gcd(L[i], R[i + 1]))
# 上のループだと、左端を除いたパターンと右端を除いたパターンが含まれないのでここで考慮に入れる
ans = max(ans, R[1])
ans = max(ans, L[-2])
print(ans)
# print(R)
# print(L)

N = int(eval(input()))
A = tuple(map(int, input().split()))
from fractions import gcd


def lcm(x, y):
    return x * y // gcd(x, y)


gcds = [0] * N
gcds[0] = A[0]
rev_gcds = [0] * N
rev_gcds[-1] = A[-1]
for i in range(1, N):
    gcds[i] = gcd(A[i], gcds[i - 1])
    rev_gcds[N - 1 - i] = gcd(A[N - 1 - i], rev_gcds[N - i])
ans = 1
for i in range(N):
    if i == 0:
        tmp = rev_gcds[i + 1]
    elif i == N - 1:
        tmp = gcds[i - 1]
    else:
        tmp = gcd(gcds[i - 1], rev_gcds[i + 1])
    ans = max(ans, tmp)
print(ans)

-A = list(map(int, input().split())) +A = tuple(map(int, input().split())) +from fractions import gcd -def gcd(a, b): -    x = max([a, b]) -    y = min([a, b]) -    while y: -        x, y = y, x % y -    return x +def lcm(x, y): +    return x * y // gcd(x, y) -L = [0] -R = [0] +gcds = [0] * N +gcds[0] = A[0] +rev_gcds = [0] * N +rev_gcds[-1] = A[-1] +for i in range(1, N): +    gcds[i] = gcd(A[i], gcds[i - 1]) +    rev_gcds[N - 1 - i] = gcd(A[N - 1 - i], rev_gcds[N - i]) +ans = 1 -    L.append(gcd(L[-1], A[i])) -for i in reversed(list(range(N))): -    R.append(gcd(R[-1], A[i])) -R = list(reversed(R)) -ans = 1 -for i in range(N - 1): -    ans = max(ans, gcd(L[i], R[i + 1])) -# 上のループだと、左端を除いたパターンと右端を除いたパターンが含まれないのでここで考慮に入れる -ans = max(ans, R[1]) -ans = max(ans, L[-2]) +    if i == 0: +        tmp = rev_gcds[i + 1] +    elif i == N - 1: +        tmp = gcds[i - 1] +    else: +        tmp = gcd(gcds[i - 1], rev_gcds[i + 1]) +    ans = max(ans, tmp) -# print(R) -# print(L)