n = int(eval(input()))

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



from fractions import gcd



tl = [a[0]]

for i in range(1, n):

    tl.append(gcd(tl[i - 1], a[i]))



tr = [a[n - 1]]

for i in range(1, n):

    tr.append(gcd(tr[i - 1], a[n - 1 - i]))

tr.reverse()



ans = 1

for i in range(n):

    tmp = 1

    l = tl[i - 1] if 0 < i else tr[i + 1]

    r = tr[i + 1] if i < n - 1 else tl[i - 1]

    ans = max(ans, gcd(l, r))

print(ans)

n = int(eval(input()))

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



from fractions import gcd



l = [a[0]]

for i in range(1, n):

    l.append(gcd(l[i - 1], a[i]))

r = [a[n - 1]]

for i in range(1, n):

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

r.reverse()

from functools import reduce



print((reduce(lambda x,y:max(x,y),[gcd(l[i-1]if 0<i else r[i+1],r[i+1] if i<n-1 else l[i-1])for i in range(n)])))
n = int(eval(input()))
a = list(map(int, input().split()))
from fractions import gcd

tl = [a[0]]
for i in range(1, n):
    tl.append(gcd(tl[i - 1], a[i]))
tr = [a[n - 1]]
for i in range(1, n):
    tr.append(gcd(tr[i - 1], a[n - 1 - i]))
tr.reverse()
ans = 1
for i in range(n):
    tmp = 1
    l = tl[i - 1] if 0 < i else tr[i + 1]
    r = tr[i + 1] if i < n - 1 else tl[i - 1]
    ans = max(ans, gcd(l, r))
print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
from fractions import gcd

l = [a[0]]
for i in range(1, n):
    l.append(gcd(l[i - 1], a[i]))
r = [a[n - 1]]
for i in range(1, n):
    r.append(gcd(r[i - 1], a[n - 1 - i]))
r.reverse()
from functools import reduce

print(
    (
        reduce(
            lambda x, y: max(x, y),
            [
                gcd(
                    l[i - 1] if 0 < i else r[i + 1], r[i + 1] if i < n - 1 else l[i - 1]
                )
                for i in range(n)
            ],
        )
    )
)

-tl = [a[0]] +l = [a[0]] -    tl.append(gcd(tl[i - 1], a[i])) -tr = [a[n - 1]] +    l.append(gcd(l[i - 1], a[i])) +r = [a[n - 1]] -    tr.append(gcd(tr[i - 1], a[n - 1 - i])) -tr.reverse() -ans = 1 -for i in range(n): -    tmp = 1 -    l = tl[i - 1] if 0 < i else tr[i + 1] -    r = tr[i + 1] if i < n - 1 else tl[i - 1] -    ans = max(ans, gcd(l, r)) -print(ans) +    r.append(gcd(r[i - 1], a[n - 1 - i])) +r.reverse() +from functools import reduce + +print( +    ( +        reduce( +            lambda x, y: max(x, y), +            [ +                gcd( +                    l[i - 1] if 0 < i else r[i + 1], r[i + 1] if i < n - 1 else l[i - 1] +                ) +                for i in range(n) +            ], +        ) +    ) +)