def gcd(x, y):

    x, y = max(x, y), min(x, y)

    if y == 0:

        return x

    return gcd(y, x % y)





n = int(eval(input()))

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



l = [0]*n

r = [0] * n

for i in range(n):

    if i == 0:

        l[i] = a[i]

        continue

    l[i] = gcd(a[i], l[i-1])



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

    if i == n - 1:

        r[i] = a[i]

        continue

    r[i] = gcd(a[i], r[i+1])



l = [0] + l[:-1]

r = r[1:] + [0]



ans = 0

for x, y in zip(l, r):

    ans = max(ans, gcd(x, y))

print(ans)

N = int(eval(input()))

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





def gcd(x, y):

    if y == 0:

        return x

    return gcd(y, x % y)





fromLeft = [0]

fromRight = [0]

for i, a in enumerate(A):

    if i == 0:

        fromLeft.append(a)

        continue

    fromLeft.append(gcd(a, fromLeft[-1]))



for i, a in enumerate(A[::-1]):

    if i == 0:

        fromRight.append(a)

        continue

    fromRight.append(gcd(a, fromRight[-1]))

fromRight = fromRight[::-1]



fromLeft[0] = fromRight[1]

fromRight[-1] = fromLeft[-2]



ans = 1

for i in range(N):

    gl = fromLeft[i]

    gr = fromRight[i + 1]

    ans = max(ans, gcd(gl, gr))



print(ans)

def gcd(x, y):
    x, y = max(x, y), min(x, y)
    if y == 0:
        return x
    return gcd(y, x % y)


n = int(eval(input()))
a = list(map(int, input().split()))
l = [0] * n
r = [0] * n
for i in range(n):
    if i == 0:
        l[i] = a[i]
        continue
    l[i] = gcd(a[i], l[i - 1])
for i in range(n - 1, -1, -1):
    if i == n - 1:
        r[i] = a[i]
        continue
    r[i] = gcd(a[i], r[i + 1])
l = [0] + l[:-1]
r = r[1:] + [0]
ans = 0
for x, y in zip(l, r):
    ans = max(ans, gcd(x, y))
print(ans)

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


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


fromLeft = [0]
fromRight = [0]
for i, a in enumerate(A):
    if i == 0:
        fromLeft.append(a)
        continue
    fromLeft.append(gcd(a, fromLeft[-1]))
for i, a in enumerate(A[::-1]):
    if i == 0:
        fromRight.append(a)
        continue
    fromRight.append(gcd(a, fromRight[-1]))
fromRight = fromRight[::-1]
fromLeft[0] = fromRight[1]
fromRight[-1] = fromLeft[-2]
ans = 1
for i in range(N):
    gl = fromLeft[i]
    gr = fromRight[i + 1]
    ans = max(ans, gcd(gl, gr))
print(ans)

+N = int(eval(input())) +A = list(map(int, input().split())) + + -    x, y = max(x, y), min(x, y) -n = int(eval(input())) -a = list(map(int, input().split())) -l = [0] * n -r = [0] * n -for i in range(n): +fromLeft = [0] +fromRight = [0] +for i, a in enumerate(A): -        l[i] = a[i] +        fromLeft.append(a) -    l[i] = gcd(a[i], l[i - 1]) -for i in range(n - 1, -1, -1): -    if i == n - 1: -        r[i] = a[i] +    fromLeft.append(gcd(a, fromLeft[-1])) +for i, a in enumerate(A[::-1]): +    if i == 0: +        fromRight.append(a) -    r[i] = gcd(a[i], r[i + 1]) -l = [0] + l[:-1] -r = r[1:] + [0] -ans = 0 -for x, y in zip(l, r): -    ans = max(ans, gcd(x, y)) +    fromRight.append(gcd(a, fromRight[-1])) +fromRight = fromRight[::-1] +fromLeft[0] = fromRight[1] +fromRight[-1] = fromLeft[-2] +ans = 1 +for i in range(N): +    gl = fromLeft[i] +    gr = fromRight[i + 1] +    ans = max(ans, gcd(gl, gr))