import fractions



n = int(eval(input()))

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



l = [0]

r = [0]

for i in range(n):

    l.append(fractions.gcd(l[i], a[i]))

    r.append(fractions.gcd(r[i], a[-(i+1)]))

    

m = [fractions.gcd(l[i], r[-(i+2)]) for i in range(n)]

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

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

p = 50

ans = 0

if p>n:p=n



def gcd(a,b):

    if a < b:

        a,b = b,a

    while b:

        a, b =b, a % b

    return a



def cul(n, x):

    l = len(x)

    b = [x[i] for i in range(l)]

    b.pop(n)

    tmp = b[0]

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

        tmp = gcd(tmp, b[i])

    return tmp

    

for i in range(p):

    s = cul(i,ls[:p])

    if s > ans:

        ans = s

print(ans)

import fractions

n = int(eval(input()))
a = list(map(int, input().split()))
l = [0]
r = [0]
for i in range(n):
    l.append(fractions.gcd(l[i], a[i]))
    r.append(fractions.gcd(r[i], a[-(i + 1)]))
m = [fractions.gcd(l[i], r[-(i + 2)]) for i in range(n)]
print((max(m)))

n = int(eval(input()))
ls = list(map(int, input().split()))
p = 50
ans = 0
if p > n:
    p = n


def gcd(a, b):
    if a < b:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a


def cul(n, x):
    l = len(x)
    b = [x[i] for i in range(l)]
    b.pop(n)
    tmp = b[0]
    for i in range(1, l - 1):
        tmp = gcd(tmp, b[i])
    return tmp


for i in range(p):
    s = cul(i, ls[:p])
    if s > ans:
        ans = s
print(ans)

-import fractions +n = int(eval(input())) +ls = list(map(int, input().split())) +p = 50 +ans = 0 +if p > n: +    p = n -n = int(eval(input())) -a = list(map(int, input().split())) -l = [0] -r = [0] -for i in range(n): -    l.append(fractions.gcd(l[i], a[i])) -    r.append(fractions.gcd(r[i], a[-(i + 1)])) -m = [fractions.gcd(l[i], r[-(i + 2)]) for i in range(n)] -print((max(m))) + +def gcd(a, b): +    if a < b: +        a, b = b, a +    while b: +        a, b = b, a % b +    return a + + +def cul(n, x): +    l = len(x) +    b = [x[i] for i in range(l)] +    b.pop(n) +    tmp = b[0] +    for i in range(1, l - 1): +        tmp = gcd(tmp, b[i]) +    return tmp + + +for i in range(p): +    s = cul(i, ls[:p]) +    if s > ans: +        ans = s +print(ans)