n=int(eval(input()))

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

from fractions import gcd

L=[0]

R=[]

l=a[0]

r=a[-1]

for i in range(n-1):

    l=gcd(a[i], l)

    L.append(l)

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

    R.append(r)

R=R[::-1]

R.append(0)

M=[]

#print(L,R)

for i in range(n):

    m=gcd(L[i],R[i])

    M.append(m)

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

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

a=sorted(a)

from math import gcd



for i in range(n):

    if i==0:

        tmp=a[i]

    else:

        tmp=gcd(tmp, a[i])



b=[x//tmp for x in a]



for i in range(n):

    if i==0:

        tmp=b[i]

    else:

        tmp=gcd(tmp, b[i])

        if tmp==1:

            l=i-1

            r=i

            break

if l>0:

    c=a[:l]+a[l+1:]

else:

    c=a[1:]

if r+1<n:

    d=a[:r]+a[r+1:]

else:

    d=a[:r]



for i in range(len(c)):

    if i==0:

        ctmp=c[i]

        dtmp=d[i]

    else:

        ctmp=gcd(ctmp, c[i])

        dtmp=gcd(dtmp, d[i])



ans=max(ctmp,dtmp)



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

    if i==n-1:

        tmp=b[i]

    else:

        tmp=gcd(tmp, b[i])

        if tmp==1:

            l=i

            r=i+1

            break

if l>0:

    c=a[:l]+a[l+1:]

else:

    c=a[1:]

if r+1<n:

    d=a[:r]+a[r+1:]

else:

    d=a[:r]



for i in range(len(c)):

    if i==0:

        ctmp=c[i]

        dtmp=d[i]

    else:

        ctmp=gcd(ctmp, c[i])

        dtmp=gcd(dtmp, d[i])



print((max(ans,ctmp,dtmp)))
n = int(eval(input()))
a = list(map(int, input().split()))
from fractions import gcd

L = [0]
R = []
l = a[0]
r = a[-1]
for i in range(n - 1):
    l = gcd(a[i], l)
    L.append(l)
    r = gcd(a[-i - 1], r)
    R.append(r)
R = R[::-1]
R.append(0)
M = []
# print(L,R)
for i in range(n):
    m = gcd(L[i], R[i])
    M.append(m)
print((max(M)))

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

for i in range(n):
    if i == 0:
        tmp = a[i]
    else:
        tmp = gcd(tmp, a[i])
b = [x // tmp for x in a]
for i in range(n):
    if i == 0:
        tmp = b[i]
    else:
        tmp = gcd(tmp, b[i])
        if tmp == 1:
            l = i - 1
            r = i
            break
if l > 0:
    c = a[:l] + a[l + 1 :]
else:
    c = a[1:]
if r + 1 < n:
    d = a[:r] + a[r + 1 :]
else:
    d = a[:r]
for i in range(len(c)):
    if i == 0:
        ctmp = c[i]
        dtmp = d[i]
    else:
        ctmp = gcd(ctmp, c[i])
        dtmp = gcd(dtmp, d[i])
ans = max(ctmp, dtmp)
for i in range(n - 1, -1, -1):
    if i == n - 1:
        tmp = b[i]
    else:
        tmp = gcd(tmp, b[i])
        if tmp == 1:
            l = i
            r = i + 1
            break
if l > 0:
    c = a[:l] + a[l + 1 :]
else:
    c = a[1:]
if r + 1 < n:
    d = a[:r] + a[r + 1 :]
else:
    d = a[:r]
for i in range(len(c)):
    if i == 0:
        ctmp = c[i]
        dtmp = d[i]
    else:
        ctmp = gcd(ctmp, c[i])
        dtmp = gcd(dtmp, d[i])
print((max(ans, ctmp, dtmp)))

-a = list(map(int, input().split())) -from fractions import gcd +(*a,) = list(map(int, input().split())) +a = sorted(a) +from math import gcd -L = [0] -R = [] -l = a[0] -r = a[-1] -for i in range(n - 1): -    l = gcd(a[i], l) -    L.append(l) -    r = gcd(a[-i - 1], r) -    R.append(r) -R = R[::-1] -R.append(0) -M = [] -# print(L,R) -    m = gcd(L[i], R[i]) -    M.append(m) -print((max(M))) +    if i == 0: +        tmp = a[i] +    else: +        tmp = gcd(tmp, a[i]) +b = [x // tmp for x in a] +for i in range(n): +    if i == 0: +        tmp = b[i] +    else: +        tmp = gcd(tmp, b[i]) +        if tmp == 1: +            l = i - 1 +            r = i +            break +if l > 0: +    c = a[:l] + a[l + 1 :] +else: +    c = a[1:] +if r + 1 < n: +    d = a[:r] + a[r + 1 :] +else: +    d = a[:r] +for i in range(len(c)): +    if i == 0: +        ctmp = c[i] +        dtmp = d[i] +    else: +        ctmp = gcd(ctmp, c[i]) +        dtmp = gcd(dtmp, d[i]) +ans = max(ctmp, dtmp) +for i in range(n - 1, -1, -1): +    if i == n - 1: +        tmp = b[i] +    else: +        tmp = gcd(tmp, b[i]) +        if tmp == 1: +            l = i +            r = i + 1 +            break +if l > 0: +    c = a[:l] + a[l + 1 :] +else: +    c = a[1:] +if r + 1 < n: +    d = a[:r] + a[r + 1 :] +else: +    d = a[:r] +for i in range(len(c)): +    if i == 0: +        ctmp = c[i] +        dtmp = d[i] +    else: +        ctmp = gcd(ctmp, c[i]) +        dtmp = gcd(dtmp, d[i]) +print((max(ans, ctmp, dtmp)))