n=int(eval(input()))

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



import fractions

ans=0

left=[0]

for i in range(1,n):

    ans=fractions.gcd(ans,al[i-1])

    left.append(ans)

#print(left)

right=[0 for i in range(n+1)]

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

    right[n-i]=fractions.gcd(right[n-i+1],al[n-i])

#print(right)



ans=0



for i in range(n):

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

print(ans)



n=int(eval(input()))

#n,m=map(int,input().split())

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

#l=[list(map(int,input().split())) for i in range(n)]



import fractions

#gcd=fractions.gcd(a,b)#最大公約数



left=[0 for i in range(n)]

right=[0 for i in range(n)]

left[0]=al[0]

right[n-1]=al[n-1]



for i in range(1,n):

    left[i]=(fractions.gcd(al[i],left[i-1]))



for i in range(n-2,-1,-1):

    right[i]=fractions.gcd(al[i],right[i+1])

    

ansl=[]

#左端の値

ansl.append(right[1])

#右端の値

ansl.append(left[n-2])



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

    ansl.append(fractions.gcd(left[i-1],right[i+1]))

print((max(ansl)))

n = int(eval(input()))
al = list(map(int, input().split()))
import fractions

ans = 0
left = [0]
for i in range(1, n):
    ans = fractions.gcd(ans, al[i - 1])
    left.append(ans)
# print(left)
right = [0 for i in range(n + 1)]
for i in range(1, n + 1):
    right[n - i] = fractions.gcd(right[n - i + 1], al[n - i])
# print(right)
ans = 0
for i in range(n):
    ans = max(ans, (fractions.gcd(left[i], right[i + 1])))
print(ans)

n = int(eval(input()))
# n,m=map(int,input().split())
al = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
import fractions

# gcd=fractions.gcd(a,b)#最大公約数
left = [0 for i in range(n)]
right = [0 for i in range(n)]
left[0] = al[0]
right[n - 1] = al[n - 1]
for i in range(1, n):
    left[i] = fractions.gcd(al[i], left[i - 1])
for i in range(n - 2, -1, -1):
    right[i] = fractions.gcd(al[i], right[i + 1])
ansl = []
# 左端の値
ansl.append(right[1])
# 右端の値
ansl.append(left[n - 2])
for i in range(1, n - 1):
    ansl.append(fractions.gcd(left[i - 1], right[i + 1]))
print((max(ansl)))

+# n,m=map(int,input().split()) +# l=[list(map(int,input().split())) for i in range(n)] -ans = 0 -left = [0] +# gcd=fractions.gcd(a,b)#最大公約数 +left = [0 for i in range(n)] +right = [0 for i in range(n)] +left[0] = al[0] +right[n - 1] = al[n - 1] -    ans = fractions.gcd(ans, al[i - 1]) -    left.append(ans) -# print(left) -right = [0 for i in range(n + 1)] -for i in range(1, n + 1): -    right[n - i] = fractions.gcd(right[n - i + 1], al[n - i]) -# print(right) -ans = 0 -for i in range(n): -    ans = max(ans, (fractions.gcd(left[i], right[i + 1]))) -print(ans) +    left[i] = fractions.gcd(al[i], left[i - 1]) +for i in range(n - 2, -1, -1): +    right[i] = fractions.gcd(al[i], right[i + 1]) +ansl = [] +# 左端の値 +ansl.append(right[1]) +# 右端の値 +ansl.append(left[n - 2]) +for i in range(1, n - 1): +    ansl.append(fractions.gcd(left[i - 1], right[i + 1])) +print((max(ansl)))