N = int(eval(input()))

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



def gcd(x, y):

    if x == 0 or y == 0:

        return max(x, y)

    return gcd(y, x % y) if y!=0 else x



w = 0

B = [w]

for x in range(N-1, 0, -1):

    B += [gcd(B[-1], A[x])]



w = 0

M = 0

for x in range(N):

    M = max(M, gcd(w, B.pop()))

    w = gcd(w, A[x])



print(M)

from fractions import*

N,*A=list(map(int,open(0).read().split()))

w,B=0,[0]

a=list(range(N))

for x in a[:]:B+=[gcd(B[-1],A[x])]

w=M=0

for x in a[::-1]:M,w=max(M,gcd(w,B[x])),gcd(w,A[x])

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


def gcd(x, y):
    if x == 0 or y == 0:
        return max(x, y)
    return gcd(y, x % y) if y != 0 else x


w = 0
B = [w]
for x in range(N - 1, 0, -1):
    B += [gcd(B[-1], A[x])]
w = 0
M = 0
for x in range(N):
    M = max(M, gcd(w, B.pop()))
    w = gcd(w, A[x])
print(M)

from fractions import *

N, *A = list(map(int, open(0).read().split()))
w, B = 0, [0]
a = list(range(N))
for x in a[:]:
    B += [gcd(B[-1], A[x])]
w = M = 0
for x in a[::-1]:
    M, w = max(M, gcd(w, B[x])), gcd(w, A[x])
print(M)

-N = int(eval(input())) -A = list(map(int, input().split())) +from fractions import * - -def gcd(x, y): -    if x == 0 or y == 0: -        return max(x, y) -    return gcd(y, x % y) if y != 0 else x - - -w = 0 -B = [w] -for x in range(N - 1, 0, -1): +N, *A = list(map(int, open(0).read().split())) +w, B = 0, [0] +a = list(range(N)) +for x in a[:]: -w = 0 -M = 0 -for x in range(N): -    M = max(M, gcd(w, B.pop())) -    w = gcd(w, A[x]) +w = M = 0 +for x in a[::-1]: +    M, w = max(M, gcd(w, B[x])), gcd(w, A[x])