def div(n):

    divisors = []

    for i in range(1, int(n**0.5)+1):

        if n % i == 0:

            divisors.append(i)

            if i != n // i:

                divisors.append(n//i)



    return divisors



n=int(eval(input()))

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

a=set(at)

d={}

for i,j in enumerate(a):

    t=div(j)

    for k in t:

        if k in d:

            d[k]+=1

        elif i==0 or k not in d:

            d[k]=1

ans=1

for i in d:

    x=0

    for j in at:

        if j%i: x+=1

    if x<2: ans=max(ans,i)

print(ans)

n=int(eval(input()))

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

d={}

for i,j in enumerate(a):

    if i<2:

        k=1

        while 1:

            if k*k>j: break

            if j%k==0:

                if k in d:

                    d[k]+=1

                else:

                    d[k]=1

            if j%k==0 and k*k!=j:

                if j//k in d:

                    d[j//k]+=1

                else:

                    d[j//k]=1

            k+=1

    else:

        for k in d:

            if j%k==0:

                if k in d:

                    d[k]+=1

            elif j%k==0 and k*k!=j:

                if j//k in d:

                    d[j//k]+=1

#print(d)

ans=chk=0

for i in d:

    if d[i]>=n-1:

        ans=max(ans,i)

print(ans)

def div(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors


n = int(eval(input()))
at = [int(i) for i in input().split()]
a = set(at)
d = {}
for i, j in enumerate(a):
    t = div(j)
    for k in t:
        if k in d:
            d[k] += 1
        elif i == 0 or k not in d:
            d[k] = 1
ans = 1
for i in d:
    x = 0
    for j in at:
        if j % i:
            x += 1
    if x < 2:
        ans = max(ans, i)
print(ans)

n = int(eval(input()))
a = [int(i) for i in input().split()]
d = {}
for i, j in enumerate(a):
    if i < 2:
        k = 1
        while 1:
            if k * k > j:
                break
            if j % k == 0:
                if k in d:
                    d[k] += 1
                else:
                    d[k] = 1
            if j % k == 0 and k * k != j:
                if j // k in d:
                    d[j // k] += 1
                else:
                    d[j // k] = 1
            k += 1
    else:
        for k in d:
            if j % k == 0:
                if k in d:
                    d[k] += 1
            elif j % k == 0 and k * k != j:
                if j // k in d:
                    d[j // k] += 1
# print(d)
ans = chk = 0
for i in d:
    if d[i] >= n - 1:
        ans = max(ans, i)
print(ans)

-def div(n): -    divisors = [] -    for i in range(1, int(n**0.5) + 1): -        if n % i == 0: -            divisors.append(i) -            if i != n // i: -                divisors.append(n // i) -    return divisors - - -at = [int(i) for i in input().split()] -a = set(at) +a = [int(i) for i in input().split()] -    t = div(j) -    for k in t: -        if k in d: -            d[k] += 1 -        elif i == 0 or k not in d: -            d[k] = 1 -ans = 1 +    if i < 2: +        k = 1 +        while 1: +            if k * k > j: +                break +            if j % k == 0: +                if k in d: +                    d[k] += 1 +                else: +                    d[k] = 1 +            if j % k == 0 and k * k != j: +                if j // k in d: +                    d[j // k] += 1 +                else: +                    d[j // k] = 1 +            k += 1 +    else: +        for k in d: +            if j % k == 0: +                if k in d: +                    d[k] += 1 +            elif j % k == 0 and k * k != j: +                if j // k in d: +                    d[j // k] += 1 +# print(d) +ans = chk = 0 -    x = 0 -    for j in at: -        if j % i: -            x += 1 -    if x < 2: +    if d[i] >= n - 1: