import fractions

def gcd(x,y):

    if x < y:

        x, y = y, x

    if y == 0:

        return x



    return fractions.gcd(x%y, y)



n = int(eval(input()))

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

L = [0]

R = [0]

now1 = 0

now2 = 0

ans = 0



for i in range(n-1):

    now1 = gcd(now1,a[i])

    L.append(now1)



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

    R.append(now2)



for i in range(n):

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



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

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



def gcd(a, b):

    if b == 0:

        return a

    else:

        return gcd(b, a%b)



L = [0] * (N+1)

R = [0] * (N+1)

for i in range(1, N+1):

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

for i in range(N)[::-1]:

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



M = [gcd(L[i], R[i+1]) for i in range(N)]



print((max(M)))
import fractions


def gcd(x, y):
    if x < y:
        x, y = y, x
    if y == 0:
        return x
    return fractions.gcd(x % y, y)


n = int(eval(input()))
a = list(map(int, input().split()))
L = [0]
R = [0]
now1 = 0
now2 = 0
ans = 0
for i in range(n - 1):
    now1 = gcd(now1, a[i])
    L.append(now1)
    now2 = gcd(now2, a[-i - 1])
    R.append(now2)
for i in range(n):
    ans = max(ans, gcd(L[i], R[n - i - 1]))
print(ans)

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


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


L = [0] * (N + 1)
R = [0] * (N + 1)
for i in range(1, N + 1):
    L[i] = gcd(L[i - 1], A[i - 1])
for i in range(N)[::-1]:
    R[i] = gcd(R[i + 1], A[i])
M = [gcd(L[i], R[i + 1]) for i in range(N)]
print((max(M)))

-import fractions +N = int(eval(input())) +A = list(map(int, input().split())) -def gcd(x, y): -    if x < y: -        x, y = y, x -    if y == 0: -        return x -    return fractions.gcd(x % y, y) +def gcd(a, b): +    if b == 0: +        return a +    else: +        return gcd(b, a % b) -n = int(eval(input())) -a = list(map(int, input().split())) -L = [0] -R = [0] -now1 = 0 -now2 = 0 -ans = 0 -for i in range(n - 1): -    now1 = gcd(now1, a[i]) -    L.append(now1) -    now2 = gcd(now2, a[-i - 1]) -    R.append(now2) -for i in range(n): -    ans = max(ans, gcd(L[i], R[n - i - 1])) -print(ans) +L = [0] * (N + 1) +R = [0] * (N + 1) +for i in range(1, N + 1): +    L[i] = gcd(L[i - 1], A[i - 1]) +for i in range(N)[::-1]: +    R[i] = gcd(R[i + 1], A[i]) +M = [gcd(L[i], R[i + 1]) for i in range(N)] +print((max(M)))