n=int(eval(input()))

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

def make_divisors(n):

    lower_divisors , upper_divisors = [], []

    i = 1

    while i*i <= n:

        if n % i == 0:

            lower_divisors.append(i)

            if i != n // i:

                upper_divisors.append(n//i)

        i += 1

    return lower_divisors + upper_divisors[::-1]

from collections import defaultdict

d=defaultdict(int)

op=set(make_divisors(a[0])+make_divisors(a[1]))

next_op=set()

for i in range(n):

    for opi in op:

        if a[i]%opi==0:

            d[opi]+=1

        if d[opi]>=i:

            next_op.add(opi)

    op=next_op

    next_op=set()

print((max(op)))

n=int(eval(input()))

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

def gcd(a, b):

  while b:

    a, b = b, a%b

  return a

al=[]

ar=[]

tmp=a[0]

al.append(a[0])

for ai in a[1:]:

  tmp=gcd(ai,tmp)

  al.append(tmp)

ar.append(a[-1])

tmp=a[-1]

for ai in a[:-1][::-1]:

  tmp=gcd(ai,tmp)

  ar.append(tmp)

ans=ar[n-2]

for i in range(n-1):

  ans=max(ans,gcd(al[i],ar[n-i-3]))

ans=max(ans,al[n-2])

print(ans)



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


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


from collections import defaultdict

d = defaultdict(int)
op = set(make_divisors(a[0]) + make_divisors(a[1]))
next_op = set()
for i in range(n):
    for opi in op:
        if a[i] % opi == 0:
            d[opi] += 1
        if d[opi] >= i:
            next_op.add(opi)
    op = next_op
    next_op = set()
print((max(op)))

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


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


al = []
ar = []
tmp = a[0]
al.append(a[0])
for ai in a[1:]:
    tmp = gcd(ai, tmp)
    al.append(tmp)
ar.append(a[-1])
tmp = a[-1]
for ai in a[:-1][::-1]:
    tmp = gcd(ai, tmp)
    ar.append(tmp)
ans = ar[n - 2]
for i in range(n - 1):
    ans = max(ans, gcd(al[i], ar[n - i - 3]))
ans = max(ans, al[n - 2])
print(ans)

-def make_divisors(n): -    lower_divisors, upper_divisors = [], [] -    i = 1 -    while i * i <= n: -        if n % i == 0: -            lower_divisors.append(i) -            if i != n // i: -                upper_divisors.append(n // i) -        i += 1 -    return lower_divisors + upper_divisors[::-1] +def gcd(a, b): +    while b: +        a, b = b, a % b +    return a -from collections import defaultdict - -d = defaultdict(int) -op = set(make_divisors(a[0]) + make_divisors(a[1])) -next_op = set() -for i in range(n): -    for opi in op: -        if a[i] % opi == 0: -            d[opi] += 1 -        if d[opi] >= i: -            next_op.add(opi) -    op = next_op -    next_op = set() -print((max(op))) +al = [] +ar = [] +tmp = a[0] +al.append(a[0]) +for ai in a[1:]: +    tmp = gcd(ai, tmp) +    al.append(tmp) +ar.append(a[-1]) +tmp = a[-1] +for ai in a[:-1][::-1]: +    tmp = gcd(ai, tmp) +    ar.append(tmp) +ans = ar[n - 2] +for i in range(n - 1): +    ans = max(ans, gcd(al[i], ar[n - i - 3])) +ans = max(ans, al[n - 2]) +print(ans)