N = int(eval(input()))

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



def gcd(x, y):

    if x == 0 or y == 0:

        return max(x, y)

    if y == 0:

        return x

    return gcd(y, x % y)



param = [[0, 0, 0]]

addr = 0

while True:

    if len(param) <= 0:

        break

    addr, Li, Lv = param.pop()

    if addr == 0:

        if Li == N-1:

            Rv = 0

            M, isCall = Lv, False

            continue            

        param += [[1, Li, Lv], [0, Li+1, gcd(Lv, A[Li])]]

        isCall = True

        continue 

    elif addr == 1:

        Rv = gcd(A[Li+1], Rv)

        M, isCall = max(M, gcd(Lv, Rv)), False

        continue



print(M)

N = int(eval(input()))

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



def gcd(x, y):

    if x == 0 or y == 0:

        return max(x, y)

    return gcd(y, x % y) if y!=0 else x



def F(init, add):

    w = [0]

    for i in range(init, init + add * N, add):

        w += [gcd(w[-1], A[i])]

    return w[:-1]



print((max(list(map(lambda x,y:gcd(x,y), F(0, 1), F(N-1, -1)[::-1])))))

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


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


param = [[0, 0, 0]]
addr = 0
while True:
    if len(param) <= 0:
        break
    addr, Li, Lv = param.pop()
    if addr == 0:
        if Li == N - 1:
            Rv = 0
            M, isCall = Lv, False
            continue
        param += [[1, Li, Lv], [0, Li + 1, gcd(Lv, A[Li])]]
        isCall = True
        continue
    elif addr == 1:
        Rv = gcd(A[Li + 1], Rv)
        M, isCall = max(M, gcd(Lv, Rv)), False
        continue
print(M)

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


def gcd(x, y):
    if x == 0 or y == 0:
        return max(x, y)
    return gcd(y, x % y) if y != 0 else x


def F(init, add):
    w = [0]
    for i in range(init, init + add * N, add):
        w += [gcd(w[-1], A[i])]
    return w[:-1]


print((max(list(map(lambda x, y: gcd(x, y), F(0, 1), F(N - 1, -1)[::-1])))))

-    if y == 0: -        return x -    return gcd(y, x % y) +    return gcd(y, x % y) if y != 0 else x -param = [[0, 0, 0]] -addr = 0 -while True: -    if len(param) <= 0: -        break -    addr, Li, Lv = param.pop() -    if addr == 0: -        if Li == N - 1: -            Rv = 0 -            M, isCall = Lv, False -            continue -        param += [[1, Li, Lv], [0, Li + 1, gcd(Lv, A[Li])]] -        isCall = True -        continue -    elif addr == 1: -        Rv = gcd(A[Li + 1], Rv) -        M, isCall = max(M, gcd(Lv, Rv)), False -        continue -print(M) +def F(init, add): +    w = [0] +    for i in range(init, init + add * N, add): +        w += [gcd(w[-1], A[i])] +    return w[:-1] + + +print((max(list(map(lambda x, y: gcd(x, y), F(0, 1), F(N - 1, -1)[::-1])))))