import math



N=int(eval(input()))

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

L=[0]*(N+1)

for i in range(N):

  L[i+1]=math.gcd(L[i],A[i])

R=[0]*(N+1)

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

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

M=[]

for i in range(N):

  M.append(math.gcd(L[i],R[i+1]))

print((max(M)))

from math import *



N=int(eval(input()))

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



left=[0]*(N+1)

for i in range(N):

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



right=[0]*(N+1)

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

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



ans=0

for i in range(N):

  ans=max(ans,gcd(left[i],right[i+1]))



print(ans)

import math

N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * (N + 1)
for i in range(N):
    L[i + 1] = math.gcd(L[i], A[i])
R = [0] * (N + 1)
for i in range(N - 1, -1, -1):
    R[i] = math.gcd(R[i + 1], A[i])
M = []
for i in range(N):
    M.append(math.gcd(L[i], R[i + 1]))
print((max(M)))

from math import *

N = int(eval(input()))
A = list(map(int, input().split()))
left = [0] * (N + 1)
for i in range(N):
    left[i + 1] = gcd(left[i], A[i])
right = [0] * (N + 1)
for i in range(N - 1, -1, -1):
    right[i] = gcd(right[i + 1], A[i])
ans = 0
for i in range(N):
    ans = max(ans, gcd(left[i], right[i + 1]))
print(ans)

-import math +from math import * -L = [0] * (N + 1) +left = [0] * (N + 1) -    L[i + 1] = math.gcd(L[i], A[i]) -R = [0] * (N + 1) +    left[i + 1] = gcd(left[i], A[i]) +right = [0] * (N + 1) -    R[i] = math.gcd(R[i + 1], A[i]) -M = [] +    right[i] = gcd(right[i + 1], A[i]) +ans = 0 -    M.append(math.gcd(L[i], R[i + 1])) -print((max(M))) +    ans = max(ans, gcd(left[i], right[i + 1])) +print(ans)