N = int(eval(input()))

A = [int(i) for i in input().split()]



def gcd(x, y):

    if x < y:

        x, y = y, x

    if y == 0:

        return x

    return gcd(x%y, y)



L = [0]

R = [0]

for i in range(N):

    L.append(gcd(A[i], L[i]))

    R.append(gcd(A[-i-1], R[i]))



R.reverse()



M = []

for i in range(0, N):

    M.append(gcd(L[i], R[i+1]))



print((max(M)))
N = int(eval(input()))

A = [int(i) for i in input().split()]



def gcd(x, y):

    if x < y:

        x, y = y, x

    while y != 0:

        x, y = y, x%y

    return x



L = [0]

R = [0]

for i in range(N):

    L.append(gcd(A[i], L[i]))

    R.append(gcd(A[-i-1], R[i]))



R.reverse()



M = []

for i in range(0, N):

    M.append(gcd(L[i], R[i+1]))



print((max(M)))

N = int(eval(input()))
A = [int(i) for i in input().split()]


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


L = [0]
R = [0]
for i in range(N):
    L.append(gcd(A[i], L[i]))
    R.append(gcd(A[-i - 1], R[i]))
R.reverse()
M = []
for i in range(0, N):
    M.append(gcd(L[i], R[i + 1]))
print((max(M)))

N = int(eval(input()))
A = [int(i) for i in input().split()]


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


L = [0]
R = [0]
for i in range(N):
    L.append(gcd(A[i], L[i]))
    R.append(gcd(A[-i - 1], R[i]))
R.reverse()
M = []
for i in range(0, N):
    M.append(gcd(L[i], R[i + 1]))
print((max(M)))

-    if y == 0: -        return x -    return gcd(x % y, y) +    while y != 0: +        x, y = y, x % y +    return x