import fractions

N = int(eval(input()))

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

hard = fractions.gcd(A[0],A[1])

easy = [A[0],A[1]]

del A[0]

del A[0]

while len(A) != 0:

  easyt1 = fractions.gcd(easy[0],A[0])

  easyt2 = fractions.gcd(easy[1],A[0])

  easyt3 = hard

  easy = sorted([easyt1,easyt2,easyt3])[1:3]

  hard = fractions.gcd(hard,A[0])

  del A[0]

print((max(easy)))
n = int(eval(input()))

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

ans1 = a[1]

for i in range(1,n):

  big,sml = a[i],ans1

  while sml != 0:

    big,sml = sml,big%sml

  ans1 = big

ans2 = a[-2]

for i in range(n-1):

  big,sml = a[i],ans2

  while sml != 0:

    big,sml = sml,big%sml

  ans2 = big

l1 = [-1]

now = a[0]

for i in range(1,n):

  big,sml = now,a[i]

  while sml != 0:

    big,sml = sml,big%sml

  l1.append(now // big)

  now = big

l2 = [-1]

now = a[-1]

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

  big,sml = now,a[i]

  while sml != 0:

    big,sml = sml,big%sml

  l2.append(now // big)

  now = big

l2.reverse()

l3 = [-1]

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

  big,sml = l1[i],l2[i]

  while sml != 0:

    big,sml = sml,big%sml

  l3.append(big)

l3.append(-1)

now = a[0]

for i in range(n):

  big,sml = now,a[i]

  while sml != 0:

    big,sml = sml,big%sml

  now = big

ans3 = now * max(l3)

#print(now)

#print(l1)

#print(l2)

#print(l3)

#print(ans1,ans2,ans3)

print((max(ans1,ans2,ans3)))
import fractions

N = int(eval(input()))
A = list(map(int, input().split()))
hard = fractions.gcd(A[0], A[1])
easy = [A[0], A[1]]
del A[0]
del A[0]
while len(A) != 0:
    easyt1 = fractions.gcd(easy[0], A[0])
    easyt2 = fractions.gcd(easy[1], A[0])
    easyt3 = hard
    easy = sorted([easyt1, easyt2, easyt3])[1:3]
    hard = fractions.gcd(hard, A[0])
    del A[0]
print((max(easy)))

n = int(eval(input()))
a = list(map(int, input().split()))
ans1 = a[1]
for i in range(1, n):
    big, sml = a[i], ans1
    while sml != 0:
        big, sml = sml, big % sml
    ans1 = big
ans2 = a[-2]
for i in range(n - 1):
    big, sml = a[i], ans2
    while sml != 0:
        big, sml = sml, big % sml
    ans2 = big
l1 = [-1]
now = a[0]
for i in range(1, n):
    big, sml = now, a[i]
    while sml != 0:
        big, sml = sml, big % sml
    l1.append(now // big)
    now = big
l2 = [-1]
now = a[-1]
for i in range(n - 2, -1, -1):
    big, sml = now, a[i]
    while sml != 0:
        big, sml = sml, big % sml
    l2.append(now // big)
    now = big
l2.reverse()
l3 = [-1]
for i in range(1, n - 1):
    big, sml = l1[i], l2[i]
    while sml != 0:
        big, sml = sml, big % sml
    l3.append(big)
l3.append(-1)
now = a[0]
for i in range(n):
    big, sml = now, a[i]
    while sml != 0:
        big, sml = sml, big % sml
    now = big
ans3 = now * max(l3)
# print(now)
# print(l1)
# print(l2)
# print(l3)
# print(ans1,ans2,ans3)
print((max(ans1, ans2, ans3)))

-import fractions - -N = int(eval(input())) -A = list(map(int, input().split())) -hard = fractions.gcd(A[0], A[1]) -easy = [A[0], A[1]] -del A[0] -del A[0] -while len(A) != 0: -    easyt1 = fractions.gcd(easy[0], A[0]) -    easyt2 = fractions.gcd(easy[1], A[0]) -    easyt3 = hard -    easy = sorted([easyt1, easyt2, easyt3])[1:3] -    hard = fractions.gcd(hard, A[0]) -    del A[0] -print((max(easy))) +n = int(eval(input())) +a = list(map(int, input().split())) +ans1 = a[1] +for i in range(1, n): +    big, sml = a[i], ans1 +    while sml != 0: +        big, sml = sml, big % sml +    ans1 = big +ans2 = a[-2] +for i in range(n - 1): +    big, sml = a[i], ans2 +    while sml != 0: +        big, sml = sml, big % sml +    ans2 = big +l1 = [-1] +now = a[0] +for i in range(1, n): +    big, sml = now, a[i] +    while sml != 0: +        big, sml = sml, big % sml +    l1.append(now // big) +    now = big +l2 = [-1] +now = a[-1] +for i in range(n - 2, -1, -1): +    big, sml = now, a[i] +    while sml != 0: +        big, sml = sml, big % sml +    l2.append(now // big) +    now = big +l2.reverse() +l3 = [-1] +for i in range(1, n - 1): +    big, sml = l1[i], l2[i] +    while sml != 0: +        big, sml = sml, big % sml +    l3.append(big) +l3.append(-1) +now = a[0] +for i in range(n): +    big, sml = now, a[i] +    while sml != 0: +        big, sml = sml, big % sml +    now = big +ans3 = now * max(l3) +# print(now) +# print(l1) +# print(l2) +# print(l3) +# print(ans1,ans2,ans3) +print((max(ans1, ans2, ans3)))