qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
import sys,math,copy
from fractions import gcd
input = sys.stdin.readline

N=int(input().strip())
A=[int(x) for x in input().strip().split()]
# def gcd(a,b):
#     if b==0:
#         return a
    
#     return gcd(b,a%b)

ANS=[]
L=[0]
R=[0]
for i in range(len(A)):
    L.append(gcd(A[i],L[i]))
    R=[gcd(A[-1-i],R[-i])]+R

for i in range(len(L)-1):
    ANS.append(gcd(L[i],R[i+1]))

print(max(ANS))


# Fixed code:
import sys,math,copy
input = sys.stdin.readline

N=int(input().strip())
A=[int(x) for x in input().strip().split()]
def gcd(a,b):
    if b==0:
        return a
    
    return gcd(b,a%b)

ANS=[]
L=[0]
R=[0]
for i in range(len(A)):
    L.append(gcd(A[i],L[-1]))
    R.append(gcd(A[-1-i],R[-1]))

R.reverse()
for i in range(len(L)-1):
    ANS.append(gcd(L[i],R[i+1]))

print(max(ANS))
# Buggy code:
def gcd(a,b):
    l = max(a,b)
    s = min(a,b)
    if s == 0:
        return l
    else:
        return gcd(s, l%s)

n = int(input())
a = [0] + list(map(int, input().split())) + [0]
max_gcd = 1
L = [0] * (n+2)
R = [0] * (n+2)

for i in range(1,n+2):
    L[i] = gcd(a[i],L[i-1])
    R[n+1-i] = gcd(a[n+1-i], R[n+2-i])
for i in range(1,n+1):
    max_gcd = max(L[i-1], R[i+1])

print(max_gcd)

# Fixed code:
def gcd(a,b):
    l = max(a,b)
    s = min(a,b)
    if s == 0:
        return l
    else:
        return gcd(s, l%s)

n = int(input())
a = [0] + list(map(int, input().split())) + [0]
max_gcd = 1
L = [0] * (n+2)
R = [0] * (n+2)

for i in range(1,n+2):
    L[i] = gcd(a[i],L[i-1])
    R[n+1-i] = gcd(a[n+1-i], R[n+2-i])
for i in range(1,n+1):
    max_gcd = max(max_gcd,gcd(L[i-1], R[i+1]))

print(max_gcd)
# Buggy code:
def gcd(a,b):
    return gcd(b, a%b) if b else a
N = int(input())
a = list(map(int,input().split()))
gcdl = [a[0]]
gcdr = [a[N-1]]
for i in range(1,N-1):
    gcdl.append(gcd(gcdl[i-1],a[i]))
    gcdr.append(gcd(gcdr[i-1],a[N-i-1]))
import numpy as np
ans = np.maximum(gcdl[N-2],gcdr[N-2])
gcdr.sort()
for i in range(1,N-1):
    if ans < gcd(gcdl[i],gcdr[i]):
        ans = gcd(gcdl[i],gcdr[i])
print(ans)

# Fixed code:
def gcd(a,b):
    return gcd(b, a%b) if b else a
N = int(input())
a = list(map(int,input().split()))
gcdl = [a[0]]
gcdr = [a[N-1]]
for i in range(1,N-1):
    gcdl.append(gcd(gcdl[i-1],a[i]))
    gcdr.append(gcd(gcdr[i-1],a[N-i-1]))
import numpy as np
ans = np.maximum(gcdl[N-2],gcdr[N-2])
gcdl.pop()
gcdr.pop()
gcdr.sort()
for i in range(N-2):
    if ans < gcd(gcdl[i],gcdr[i]):
        ans = gcd(gcdl[i],gcdr[i])
print(ans)
# Buggy code:
def gcd(a,b):
    if b==0:
        return max(a,b)
    else:
        if a%b == 0:
            return(b)
        else:
            return gcd(b,a%b)
n = int(input())
a = list(map(int,input().split()))
l=[0 for i in range(n+1)]
r=[0 for i in range(n+1)]

for i in range(1,n):
    l[i]=gcd(l[i-1],a[i-1])
    r[i]=gcd(r[i-1],a[n-i])
for i in range(n):
    e[i] = gcd(l[i],r[n-1-i])
print(max(e))


# Fixed code:
def gcd(a,b):
    if b==0:
        return max(a,b)
    else:
        if a%b == 0:
            return(b)
        else:
            return gcd(b,a%b)
n = int(input())
a = list(map(int,input().split()))
l=[0 for i in range(n)]
r=[0 for i in range(n)]
e=[0 for i in range(n)]
for i in range(1,n):
    l[i]=gcd(l[i-1],a[i-1])
    r[i]=gcd(r[i-1],a[n-i])
for i in range(n):
    e[i] = gcd(l[i],r[n-1-i])
print(max(e))
# Buggy code:
N = int(input())
A = list(map(int,input().split(" ")))

def gcd(m,n):
    while n != 0:
        a = n
        n = m % n
        m = a
    return m

l = [0]*N
r = [0]*N

l[0] = A[0]
r[-1] = A[-1]

for x in range(1,N):
    y = N - 1 - x
    l[x] = gcd(A[x],l[x-1])
    r[y] = gcd(A[y],r[y+1])

l.insert(0,0)
l.append(0)
r.insert(0,0)
r.append(0)

o = 1

for x in range(N):
    x += 1
    o = max(o,gcd(l[x-1],r[x+1]))

print(max(o))

# Fixed code:
N = int(input())
A = list(map(int,input().split(" ")))

def gcd(m,n):
    while n != 0:
        a = n
        n = m % n
        m = a
    return m

l = [0]*N
r = [0]*N

l[0] = A[0]
r[-1] = A[-1]

for x in range(1,N):
    y = N - 1 - x
    l[x] = gcd(A[x],l[x-1])
    r[y] = gcd(A[y],r[y+1])

l.insert(0,0)
l.append(0)
r.insert(0,0)
r.append(0)

o = 1

for x in range(N):
    o = max(o,gcd(l[x],r[x+2]))

print(o)
# Buggy code:
def gcd(a, b):  # a >= b
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def makelist(n, m):
    return [[0 for i in range(m)] for j in range(n)]

N = int(input())
A = [0] + list(map(int, input().split()))

toRight = [0]*(N+1)
toRight[1] = A[1]
for i in range(2, N+1):
    toRight[i] = gcd(toRight[i-1], A[i])

toLeft = [0]*(N+1)
toLeft[N] = A[N]
for i in reversed(range(1, N)):
    toLeft[i] = gcd(toLeft[i+1], A[i])
    
ans = max(toRight[-2], toLeft[2])
for i in range(3, N-3 + 1):
    now = gcd(toRight[i-1], toLeft[-i-1])
    ans = max(ans, now)

print(ans)


# Fixed code:
def gcd(a, b):  # a >= b
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def makelist(n, m):
    return [[0 for i in range(m)] for j in range(n)]

N = int(input())
A = [0] + list(map(int, input().split()))

toRight = [0]*(N+1)
toRight[1] = A[1]
for i in range(2, N+1):
    toRight[i] = gcd(toRight[i-1], A[i])

toLeft = [0]*(N+1)
toLeft[N] = A[N]
for i in reversed(range(1, N)):
    toLeft[i] = gcd(toLeft[i+1], A[i])

# print(toRight)
# print(toLeft)
    
ans = max(toRight[-2], toLeft[2])
for i in range(2, N-1 + 1):
    now = gcd(toRight[i-1], toLeft[i+1])
    ans = max(ans, now)

print(ans)
# Buggy code:
N = int(input())
A = list(map(int,input().split(' ')))

def myGCD(a,b):
    if a == 0:
        return b
    while b!=0:
        a,b = b,a%b
    return a

L=[]
R=[]
for i in range(N):
    L.append(0)
    R.append(0)

for i in range(N-1):
    L[i+1]=myGCD(L[i],A[i])

for i in range(N-2,-1,-1):
    #print(i)
    R[i] = myGCD(R[i+1],A[i])

M=[]
for i in range(N):
    M.append(myGCD(R[i],L[i]))

print(max(M))

# Fixed code:
N = int(input())
A = list(map(int,input().split(' ')))

def myGCD(a,b):
    if a == 0:
        return b
    while b!=0:
        a,b = b,a%b
    return a

L=[]
R=[]
for i in range(N):
    L.append(0)
    R.append(0)

for i in range(N-1):
    L[i+1]=myGCD(L[i],A[i])

for i in range(N-2,-1,-1):
    #print(i)
    R[i] = myGCD(R[i+1],A[i+1])

M=[]
for i in range(N):
    M.append(myGCD(R[i],L[i]))
#print(L)
#print(R)

print(max(M))
# Buggy code:
def gcd(a, b):  # a>b
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


N = int(input())
A = list(map(int, input().split()))
R = [0 for i in range(N - 1)]
L = [0 for i in range(N - 1)]
R[0] = A[0]
L[0] = A[-1]
for i in range(1, N - 1):
    R[i] = gcd(R[i - 1], A[i])
for j in range(1, N - 1):
    L[j] = gcd(L[j - 1], A[-1 - j])
    # print(L[j])
t = 0
for i in range(N - 2):
    print(R[i], L[N - 3 - i])
    t = max(t, gcd(R[i], L[N - 3 - i]))
print(max(t, R[-1], L[-1]))


# Fixed code:
def gcd(a, b):  # a>b
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


N = int(input())
A = list(map(int, input().split()))
R = [0 for i in range(N - 1)]
L = [0 for i in range(N - 1)]
R[0] = A[0]
L[0] = A[-1]
for i in range(1, N - 1):
    R[i] = gcd(R[i - 1], A[i])
for j in range(1, N - 1):
    L[j] = gcd(L[j - 1], A[-1 - j])
    # print(L[j])
t = 0
for i in range(N - 2):
    # print(R[i], L[N - 3 - i])
    t = max(t, gcd(R[i], L[N - 3 - i]))
print(max(t, R[-1], L[-1]))
# Buggy code:
N = int(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 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))


# Fixed code:
N = int(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))
# Buggy code:
from functools import reduce
inf = 10**10
import sys
input = sys.stdin.readline
def gcd_list(numbers):
    return reduce(math.gcd,numbers)
n = int(input())
a = list(map(int,input().split()))
index = inf
if n == 2:
    print(max(a))
else:
    a.sort()
    if math.gcd(a[0],a[n-1]) == 1:
        print(max(gcd_list(a[1:n]),gcd_list(a[0:n-1])))
    else:
        for i in range(1,n-1):
            ans = math.gcd(a[0],a[n-1])
            if math.gcd(a[i]-a[0],a[n-1]-a[i]) <= ans:
                index = i
                ans = math.gcd(a[i]-a[0],a[n-1]-a[i])
        print(gcd_list(a[0:i]+a[i+1:n]))

# Fixed code:
from functools import reduce
inf = 10**10
import sys
input = sys.stdin.readline


def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
def gcd_list(numbers):
    return reduce(gcd,numbers)
n = int(input())
a = list(map(int,input().split()))
index = inf
if n == 2:
    print(max(a))
else:
    a.sort()
    if gcd(a[0],a[n-1]) == 1:
        print(max(gcd_list(a[1:n]),gcd_list(a[0:n-1])))
    else:
        ans = gcd(a[0],a[n-1])
        for i in range(1,n-1):
            if gcd(a[i]-a[0],a[n-1]-a[i]) <= ans:
                index = i
                ans = gcd(a[i]-a[0],a[n-1]-a[i])
        print(max(gcd_list(a[0:index]+a[index+1:n]),gcd_list(a[1:n]),gcd_list(a[0:n-1])))
# Buggy code:

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


import sys
if n == 2:
    print(max(a))
    sys.exit()


def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


g = a[0]
gcd_left = [g]
for i in range(n-1):
    g = gcd(g, a[i+1])
    gcd_left.append(g)

g = a[n-1]
gcd_right = [g]
for i in range(n-1):
    g = gcd(g, a[n-2-i])
    gcd_right.append(g)

max_gcd = gcd_right[n-1]
for i in range(1, n-1):
    max_gcd = max(max_gcd, gcd(gcd_left(i-1), gcd_right(n - 2 - i)))
max_gcd = max(max_gcd, gcd_left[n-1])

print(max_gcd)

# Fixed code:

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


import sys
if n == 2:
    print(max(a))
    sys.exit()


def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


g = a[0]
gcd_left = [g]
for i in range(n-1):
    g = gcd(g, a[i+1])
    gcd_left.append(g)

g = a[n-1]
gcd_right = [g]
for i in range(n-1):
    g = gcd(g, a[n-2-i])
    gcd_right.append(g)

max_gcd = gcd_right[n-2]
for i in range(1, n-1):
    max_gcd = max(max_gcd, gcd(gcd_left[i-1], gcd_right[n - 2 - i]))
max_gcd = max(max_gcd, gcd_left[n-2])

print(max_gcd)
# Buggy code:
def gcd(a, b):
    if b > a:
        a, b = b, a
    if a % b == 0:
        return b
    return gcd(a%b, b)


N = int(input())
A = [int(s) for s in input().split(" ")]

left = A.copy()
right = A.copy()

for i in range(1, N):
    left[i] = gcd(left[i-1], left[i])

for i in reversed(range(0, N-1)):
    right[i] = gcd(right[i+1], right[i])

print((left, right))

ans = max(right[1], left[-2])

for i in range(1, N-1):
    ans = max(ans, gcd(left[i-1], right[i+1]))

print(ans)

# Fixed code:
def gcd(a, b):
    if b > a:
        a, b = b, a
    if a % b == 0:
        return b
    return gcd(a%b, b)


N = int(input())
A = [int(s) for s in input().split(" ")]

left = A.copy()
right = A.copy()

for i in range(1, N):
    left[i] = gcd(left[i-1], left[i])

for i in reversed(range(0, N-1)):
    right[i] = gcd(right[i+1], right[i])

ans = max(right[1], left[-2])

for i in range(1, N-1):
    ans = max(ans, gcd(left[i-1], right[i+1]))

print(ans)
# Buggy code:
import math
from itertools import accumulate

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

fromleft = list(accumulate(a, math.gcd))
a.reverse()
fromright = list(accumulate(a, math.gcd))
fromright.reverse()
a.reverse()

gcd = []

gcd.append(fromright[1])
for i in range(1, n-1):
    gcd.append(math.gcd(fromleft[i-1], fromright[i+1]))
    print(i, fromright[i-1], fromleft[i+1])

gcd.append(fromleft[n-2])

if n == 2:
    print(max(a[1], a[0]))
else:
    print(max(gcd))


# Fixed code:
import math
from itertools import accumulate

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

fromleft = list(accumulate(a, math.gcd))
a.reverse()
fromright = list(accumulate(a, math.gcd))
fromright.reverse()
a.reverse()

gcd = []

gcd.append(fromright[1])
for i in range(1, n-1):
    gcd.append(math.gcd(fromleft[i-1], fromright[i+1]))

gcd.append(fromleft[n-2])

if n == 2:
    print(max(a[1], a[0]))
else:
    print(max(gcd))
# Buggy code:
N = int(input()) 
def gcd(m, n):
  a = max(m,n)
  b = min(m,n)
  if a%b==0:
    return b
  while not a % b == 0:
      a, b = b, a % b
  return b

arr = [int(item) for item in input().split()]
a = [arr[0]]
b = [arr[-1]]
for i in range(1, N):
  a.append(gcd(a[i-1], arr[i]))
  b.append(gcd(b[i-1], arr[N-i-1]))
ans = max(a[-2], b[-2])

for i, j in zip(a[:-3], b[:-3:-1]):
  ans = max(ans, gcd(i,j))
print(ans)


# Fixed code:
N = int(input()) 
def gcd(m, n):
  a = max(m,n)
  b = min(m,n)
  if a%b==0:
    return b
  while not a % b == 0:
      a, b = b, a % b
  return b

arr = [int(item) for item in input().split()]
a = [arr[0]]
b = [arr[-1]]
for i in range(1, N):
  a.append(gcd(a[i-1], arr[i]))
  b.append(gcd(b[i-1], arr[N-i-1]))
ans = max(a[-2], b[-2])
b = b[::-1]
for i, j in zip(a[:-2], b[2:]):
  ans = max(ans, gcd(i,j))
print(ans)
# Buggy code:
import math
from itertools import accumulate

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

fromright = list(accumulate(a, math.gcd))
a.reverse()
fromleft = list(accumulate(a, math.gcd))
fromleft.reverse()

gcd = []

gcd.append(fromleft[1])

for i in range(1, n-1):
  gcd.append(math.gcd(fromright[i-1], fromleft[i+1]))

gcd.append(fromright[1])

if n == 2:
  print(max(a))

# Fixed code:
import math
from itertools import accumulate

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

fromleft = list(accumulate(a, math.gcd))
fromright = list(accumulate(a[::-1], math.gcd))[::-1]

gcd = []

gcd.append(fromright[1])
for i in range(1, n-1):
    gcd.append(math.gcd(fromleft[i-1], fromright[i+1]))
gcd.append(fromleft[n-2])

print(max(gcd))
# Buggy code:
def gcd(x,y):
  if y == 0:
    return x
  else:
    return gcd(y,x%y)

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

accum_gcd = []
gcd_A = A[0]
for j in range(n):
    gcd_A = gcd(gcd_A,A[j])
    accum_gcd.append(gcd(gcd_A,A[j]))

accum_gcd_i = []
A_i = A[::-1]
gcd_A_i = A_i[0]
for j in range(n):
    gcd_A_i = gcd(gcd_A_i,A_i[j])
    accum_gcd_i.append(gcd(gcd_A_i,A_i[j]))

accum_gcd_pop = []

for j in range(n):
    if j == 0:
        accum_gcd_pop.append(accum_gcd_i[n-1])
    elif j == n-1:
        accum_gcd_pop.append(accum_gcd[n-1])
    else:
        accum_gcd_pop.append(gcd(accum_gcd[j-1],accum_gcd_i[n-j-2]))
print(max(accum_gcd_pop))

# Fixed code:
def gcd(x,y):
  if y == 0:
    return x
  else:
    return gcd(y,x%y)

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

accum_gcd = []
gcd_A = A[0]
for j in range(n):
    gcd_A = gcd(gcd_A,A[j])
    accum_gcd.append(gcd(gcd_A,A[j]))

accum_gcd_i = []
A_i = A[::-1]
gcd_A_i = A_i[0]
for j in range(n):
    gcd_A_i = gcd(gcd_A_i,A_i[j])
    accum_gcd_i.append(gcd(gcd_A_i,A_i[j]))

accum_gcd_pop = []

for j in range(n):
    if j == 0:
        accum_gcd_pop.append(accum_gcd_i[n-2])
    elif j == n-1:
        accum_gcd_pop.append(accum_gcd[n-2])
    else:
        accum_gcd_pop.append(gcd(accum_gcd[j-1],accum_gcd_i[n-j-2]))
print(max(accum_gcd_pop))
# Buggy code:
def gcd(x,y):
    if x<y:
        x,y=y,x
    while x%y!=0:
        x,y=y,x%y
    return(y)

n=int(input())

v=[]
line=input().split()

for i in range(n):
    v.append(int(line[i]))

gcd_l=[]
gcd_r=[]

for i in range(n):
    if i==0:
        gcd_l.append(v[i])
    else:
        gcd_l.append(gcd(gcd_l[i-1],v[i]))

for i in range(n):
    if i==0:
        gcd_r.append(v[n-1])
    else:
        gcd_r.append(gcd(gcd_r[i-1],v[n-i-1]))

print(gcd_l,gcd_r)

gcd_list=[]

for i in range(n):
    if i==0:
        gcd_list.append(gcd_r[n-2])
    elif i==n-1:
        gcd_list.append(gcd_l[n-2])
    else:
        gcd_list.append(gcd(gcd_l[i-1],gcd_r[i-1]))

print(max(gcd_list))

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

n=int(input())

v=[]
line=input().split()

for i in range(n):
    v.append(int(line[i]))

gcd_l=[]
gcd_r=[]

for i in range(n-1):
    if i==0:
        gcd_l.append(v[i])
    else:
        gcd_l.append(gcd(gcd_l[i-1],v[i]))

for i in range(n-1):
    if i==0:
        gcd_r.append(v[n-1])
    else:
        gcd_r.append(gcd(gcd_r[i-1],v[n-i-1]))

gcd_list=[]

for i in range(n):
    if i==0:
        gcd_list.append(gcd_r[n-2])
    elif i==n-1:
        gcd_list.append(gcd_l[n-2])
    else:
#        print(gcd(gcd_l[i-1],gcd_r[n-i-2]))
        gcd_list.append(gcd(gcd_l[i-1],gcd_r[n-i-2]))

#print(gcd_list)

print(max(gcd_list))
# Buggy code:
N = int(input())
A = list(map(int, input().split()))
def divi(a, b):
    rem = b % a
    if rem == 0:
        return a
    else:
        return divi(rem, a)
A.sort()
all_d = A[0]
max_d = max(divi(A[0],A[1]), divi(A[0],A[2])) if N > 2 else A[1]
for i in range(1,N):
    d = divi(all_d, A[i])
    max_d = divi(max_d, A[i])
    if max_d < d:
        max_d = all_d
    all_d = d
print(max_d)

# Fixed code:
N = int(input())
A = list(map(int, input().split()))
def divi(a, b):
    rem = b % a
    if rem == 0:
        return a
    else:
        return divi(rem, a)
A.sort()
all_d = divi(A[0], A[1])
max_d = max(all_d, max(divi(A[1],A[2]), divi(A[0],A[2]))) if N > 2 else A[1]
for i in range(2,N):
    d = divi(all_d, A[i])
    max_d = divi(max_d, A[i])
    if max_d < all_d:
        max_d = all_d
    all_d = d
print(max_d)
# Buggy code:
# Segment tree (GCD)
class SegmentTree:
    _f = None
    _data = None
    _offset = None
    _size = None

    def __init__(self, size, f):
        self._f = f
        self._size = size
        t = 1
        while t < size:
            t *= 2
        self._offset = t - 1
        self._data = [0] * (t * 2 - 1)

    def build(self, iterable):
        data = self._data
        data[self._offset:self._offset + self._size] = iterable
        for i in range(self._offset - 1, -1, -1):
            data[i] = data[i * 2 + 1] + data[i * 2 + 2]

    def query(self, start, stop):
        def iter_segments(data, l, r):
            while l < r:
                if l & 1 == 0:
                    yield data[l]
                if r & 1 == 0:
                    yield data[r - 1]
                l = l // 2
                r = (r - 1) // 2
        f = self._f
        it = iter_segments(self._data, start + self._offset,
                           stop + self._offset)
        result = next(it)
        for e in it:
            result = f(result, e)
        return result


from math import gcd

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

st = SegmentTree(N, gcd)
st.build(A)

result = st.query(1, N)
for i in range(1, N - 1):
    result = max(result, gcd(st.query(0, i), st.query(i + 1, N)))
result = max(result, st.query(0, N - 1))
print(result)


# Fixed code:
# Segment tree (GCD)
from math import gcd


class SegmentTree:
    _f = None
    _data = None
    _offset = None
    _size = None

    def __init__(self, size, f):
        self._f = f
        self._size = size
        t = 1
        while t < size:
            t *= 2
        self._offset = t - 1
        self._data = [0] * (t * 2 - 1)

    def build(self, iterable):
        f = self._f
        data = self._data
        data[self._offset:self._offset + self._size] = iterable
        for i in range(self._offset - 1, -1, -1):
            data[i] = f(data[i * 2 + 1], data[i * 2 + 2])

    def query(self, start, stop):
        def iter_segments(data, l, r):
            while l < r:
                if l & 1 == 0:
                    yield data[l]
                if r & 1 == 0:
                    yield data[r - 1]
                l = l // 2
                r = (r - 1) // 2
        f = self._f
        it = iter_segments(self._data, start + self._offset,
                           stop + self._offset)
        result = next(it)
        for e in it:
            result = f(result, e)
        return result


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

st = SegmentTree(N, gcd)
st.build(A)

result = st.query(1, N)
for i in range(1, N - 1):
    result = max(result, gcd(st.query(0, i), st.query(i + 1, N)))
result = max(result, st.query(0, N - 1))
print(result)
# Buggy code:
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


N = int(input())
A = list(map(int, input().split()))
L = [0 for i in range(N)]
R = [0 for i in range(N)]
T = [0 for i in range(N)]

for i in range(N):
    if i == 0:
        L[i] = 0
    else:
        L[i] = gcd(L[i-1], A[i-1])
for i in range(N-1, 0, -1):
    if i == N-1:
        R[i] = 0
    else:
        R[i] = gcd(R[i+1], A[i+1])
for i in range(N):
    T[i] = gcd(L[i], R[i])

print(T)

# Fixed code:
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


N = int(input())
A = list(map(int, input().split()))
L = [0 for i in range(N)]
R = [0 for i in range(N)]
T = [0 for i in range(N)]

for i in range(N):
    if i == 0:
        L[i] = 0
    else:
        L[i] = gcd(L[i-1], A[i-1])
for i in reversed(range(0, N)):
    if i == N-1:
        R[i] = 0
    else:
        R[i] = gcd(R[i+1], A[i+1])
for i in range(N):
    T[i] = gcd(L[i], R[i])

print(max(T))
# Buggy code:
def gcd(a,b):
  while b:a,b=b,a%b
  return a
n=int(input())
a=list(map(int,input().split()))
left=[a[0]]
for i in range(1,n):left.append(gcd(left[-1],a[i]))
right=[a[n-1]]
for i in range(n-2,-1,-1):right.append(gcd(right[-1],a[i]))
right.reverse()
ans=max(right[1],left[n-2])
print(max(ans,max(gcd(left[i-1],right[i+1])for i in range(1,n-1))))

# Fixed code:
def gcd(a,b):
  while b:a,b=b,a%b
  return a
n=int(input())
a=list(map(int,input().split()))
if n==2:print(max(a[0],a[1]));exit()
left=[a[0]]
for i in range(1,n):left.append(gcd(left[-1],a[i]))
right=[a[n-1]]
for i in range(n-2,-1,-1):right.append(gcd(right[-1],a[i]))
right.reverse()
ans=max(right[1],left[n-2])
print(max(ans,max(gcd(left[i-1],right[i+1])for i in range(1,n-1))))
# Buggy code:
n = int(input())
a = list(map(int, input().split()))

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

s1 = [a[0]]
s2 = [a[-1]]
for i in range(1, len(a)-1):
    s1.append(gcd(s1[-1], a[i]))
    s2 = [gcd(s2[-1], a[-(i+1)])] + s2
s1 = [a[-1]] + s1
s2 = s2 + [a[0]]


ans = 0
for i in range(len(s1)):
    ans = max(ans, (gcd(s1[i], s2[i])))

print(max(ans))

# Fixed code:
n = int(input())
a = list(map(int, input().split()))

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

s1 = [0]*(n + 1)
s2 = [0]*(n + 1)
for i in range(1, n):
    s1[i] = gcd(s1[i-1], a[i-1])
    s2[n-i] = gcd(s2[n-i+1], a[n-i])

ans = 0
for i in range(n):
    ans = max(ans, (gcd(s1[i], s2[i+1])))

print(ans)
# Buggy code:
def gcd(x, y):
if y == 0:
    return x
else:
    return gcd(y, x % y)

n = int(input())
aaa = list(map(int, input().split()))
cnt_l = [0] * (n - 1)
cnt_r = [0] * (n - 1)

cnt_l[0] = aaa[0]
for i in range(1, n - 1):
cnt_l[i] = gcd(cnt_l[i - 1], aaa[i])

aaa.reverse()
cnt_r[0] = aaa[0]
for i in range(1, n - 1):
cnt_r[i] = gcd(cnt_r[i - 1], aaa[i])

cnt_l = [cnt_r[-1]] + cnt_l
cnt_r = [cnt_l[-1]] + cnt_r
cnt_r.reverse()

ans = 0
for i in range(n - 1):
tmp = gcd(cnt_l[i], cnt_r[i])
ans = max(ans, tmp)

print(ans)


# Fixed code:
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

n = int(input())
aaa = list(map(int, input().split()))
cnt_l = [0] * (n - 1)
cnt_r = [0] * (n - 1)

cnt_l[0] = aaa[0]
for i in range(1, n - 1):
    cnt_l[i] = gcd(cnt_l[i - 1], aaa[i])

aaa.reverse()
cnt_r[0] = aaa[0]
for i in range(1, n - 1):
    cnt_r[i] = gcd(cnt_r[i - 1], aaa[i])

cnt_l = [cnt_r[-1]] + cnt_l
cnt_r = [cnt_l[-1]] + cnt_r
cnt_r.reverse()

ans = 1
for i in range(n):
    tmp = gcd(cnt_l[i], cnt_r[i])
    ans = max(ans, tmp)

print(ans)
# Buggy code:
a_c = list(map(int, input().split()))

if a_c[0] < a_c[2] < a_c[1]:
    print("Yes")

else:
    print("No")

# Fixed code:
a_c = list(map(int, input().split()))

if min(a_c[0], a_c[1]) < a_c[2] < max(a_c[0], a_c[1]):
    print("Yes")

else:
    print("No")
# Buggy code:
A,B,C=map(int,input().split())
print('Yes' if (C-A)*(C-B)<0 else 'NO')

# Fixed code:
A,B,C=map(int,input().split())
print('Yes' if (C-A)*(C-B)<0 else 'No')