Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import random


A, B = [int(str) for str in input().split()]

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

def is_prime(q,k=4):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    #n-1=2^s*dとし(但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

def make_divisors(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)

    divisors.sort()
    return divisors


prime_list = [1] + [i for i in range(1, gcd(A, B) + 1) if is_prime(i)]
print(len([i for i in prime_list if A % i == 0 and B % i == 0]))

### FIXED CODE ###

A, B = [int(str) for str in input().split()]

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


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


print(len(set(prime_factorize(gcd(A, B)))) + 1)
### BUGGY CODE ###

from bisect import insort_left

def main():
  N, M = map(int, input().split())
  A = sorted(list(map(int, input().split())))

  for i in range(M):
    a = A.pop(N-1)  
    insort_left(A, a//2)

  print(sum(list(map(int, A))))  	
  
if __name__ == '__main__':
  main()

### FIXED CODE ###

from heapq import heappush, heappop, heapify

def main():
  N, M = map(int, input().split())
  A = list(map(int, input().split()))

  if N == 1: A[0] = A[0] // 2 ** M
  else:
    for i in range(N): A[i] *= -1

    heapify(A)

    for i in range(M):
      a = heappop(A)
      heappush(A, -(-a//2))

  print(-sum(A))  
  
if __name__ == '__main__':
  main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
vs = set()
def dfs_w(d, stack):
    depth = [-1] + [0]*N
    pvs = set()
    if stack[0] in vs:
        return True
    while stack:
        v, dpd = stack.pop()
        vs.add(v)
        pvs.add(v)

        for u, dpd in d[v]:
            if u in pvs:
                if depth[u] != depth[v] + dpd:
                    return False
            if u in vs:
                continue
            depth[u] = depth[v] + dpd
            stack += [(u, dpd)]

    return True

if __name__ == '__main__':
    N, M = map(int, input().split())
    G = [set() for _ in range(N+1)]
    for _ in range(M):
        a, b, c = map(int, input().split())
        G[a].add((b,c))
        G[b].add((a,-c))
    for i in range(N):
        if i+1 in vs:
            continue
        stack = [(i+1, 0)] 
        r =  dfs_w(G, stack)
        if not r:
            break
    if r:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

import sys
input = sys.stdin.readline
vs = set()
def dfs_w(d, stack):
    depth = defaultdict(int)
    pvs = set()
    while stack:
        v = stack.pop()
        vs.add(v)
        pvs.add(v)
        for u, dpd in d[v]:
            if u in pvs:
                if depth[u] != depth[v] + dpd:
                    return False
            if u in vs:
                continue
            depth[u] = depth[v] + dpd
            stack.append(u)
    return True

if __name__ == '__main__':
    from collections import defaultdict
    N, M = map(int, input().split())
    G = defaultdict(set)
    for _ in range(M):
        a, b, c = map(int, input().split())
        G[a].add((b,c))
        G[b].add((a,-c))
    for i in range(N):
        if i+1 in vs:
            continue
        stack = [i+1] 
        r =  dfs_w(G, stack)
        if not r:
            break
    if r:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

# https://atcoder.jp/contests/abc138/tasks/abc138_d

from collections import deque

def bfs(graph, start, query, n):
    queue = deque([])
    acc = query[start] if start in query else 0
    queue.append([start, acc])
    ans = [-1] * n
    ans[start] = acc

    while queue:
        idx, acc = queue.popleft()
        for child in graph[idx].keys():
            if ans[child] >= 0:
                continue
            ans[child] = acc
            if child in query:
                ans[child] += query[child]
            queue.append([child, ans[child]])
    
    print(' '.join(map(str, ans)))

n,q = map(int, input().split())
tree = {}
start = 0
for i in range(n-1):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    if a not in tree:
        tree[a] = {}
    tree[a][b] = 1
    if b not in tree:
        tree[b] = {}
    tree[b][a] = 1

query = {}
for _ in range(q):
    p, x = map(int,input().split())
    p -= 1
    if p not in query:
        query[p] = x
    else:
        query[p] += x
bfs(tree, start, query, n)


### FIXED CODE ###

# https://atcoder.jp/contests/abc138/tasks/abc138_d

from collections import deque

def bfs(graph, start, query, n):
    queue = deque([])
    acc = query[start] if start in query else 0
    queue.append([start, acc])
    ans = [-1] * n
    ans[start] = acc

    while queue:
        idx, acc = queue.popleft()
        for child in graph[idx].keys():
            if ans[child] >= 0:
                continue
            ans[child] = acc
            if child in query:
                ans[child] += query[child]
            queue.append([child, ans[child]])
    
    print(' '.join(map(str, ans)))

n,q = map(int, input().split())
tree = {}
start = 0
for i in range(n-1):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    if a not in tree:
        tree[a] = {}
    tree[a][b] = 1
    if b not in tree:
        tree[b] = {}
    tree[b][a] = 1

query = {}
for _ in range(q):
    p, x = map(int,input().split())
    p -= 1
    if p not in query:
        query[p] = x
    else:
        query[p] += x
bfs(tree, start, query, n)
### BUGGY CODE ###

s = [0] + map(int,list(raw_input()))
dp = [+float('inf')] * len(s)

for j in range(len(s) - 1, -1, -1):
	a = s[j]
	if j+ 1 < len(dp): a += dp[j + 1] 
	dp[j] = min(a, dp[j])

	b = s[j] + 1
	q = 0
	for jj in range(j+1, len(s)):
		q += 9 - s[jj]
		dp[j] = min(dp[j], b + q + 1 +(dp[jj+1] if jj+1 < len(dp) else 0))

print dp[0]





### FIXED CODE ###

s = map(int,list(raw_input()))
dp = [[0,0] for _ in range(len(s))]
for i in range(len(dp)):
	a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i]
	b = (dp[i - 1][1] if i - 1 >= 0 else 1) + 10 - s[i]
	dp[i][0] = min(a,b)

	a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i] + 1
	b = (dp[i - 1][1] if i - 1 >= 0 else 1) + 10 - s[i] - 1
	dp[i][1] = min(a,b)
print dp[-1][0]
### BUGGY CODE ###

from fractions import gcd


def p_c():
    from sys import stdin
    input = stdin.readline
    n = int(input())
    *a, = map(int, input().split())
    ans = 0
    for i in range(n):
        tmp = a[i]
        a[i] = 0
        g = a[0]
        for j in range(1, n):
            g = gcd(g, a[j])
        a[i] = tmp
        if ans < g:
            ans = g
    print(ans)
    
if __name__ == '__main__':
    p_c()

### FIXED CODE ###

from fractions import gcd


def p_c():
    n = int(input())
    *a, = map(int, input().split())
    L = [0] * n
    R = [0] * n
    for i in range(n - 1):
        L[i] = gcd(L[i - 1], a[i])
        R[n - 1 - i] = gcd(R[(n - i) % n], a[n - 1 - i])
    ans = [gcd(L[i - 1], R[(i + 1) % n]) for i in range(n)]
    print(max(ans))

p_c()
### BUGGY CODE ###

from sys import stdin, stdout
def main():  
    n = int(stdin.readline())
    ans = 1
    a = stdin.readline()
    k = a.split(' ')
    for i in k:
        ans = ans*int(i)
    if ans > 1e18:
        ans = -1
    stdout.write(str(ans)) 
  
if __name__ == "__main__": 
    main()     


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
if a[0]==0:
  print("0")
else:
  ans = 1
  for i in range(n):
    ans = ans*a[i]
    if ans > 1e18:
      print("-1")
      break
  else:
    print(ans)
### BUGGY CODE ###

n = int(input())

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

d.sort()

m = 0

for a in range(n-2):
	for b in range(a+1,n-1):
		for c in range(b+1,n):
			if d[c]<d[b]+d[a]:
				m += 1
				if d[c]==d[a]:
					m -= 1
			else:
				break

print(m)

### FIXED CODE ###

import bisect

n = int(input())
d = list(map(int, input().split()))
d.sort()

m = 0

for a in range(n-2):
	for b in range(a+1,n-1):
		m+=bisect.bisect_left(d,d[a]+d[b])-1-b

print(m)
### BUGGY CODE ###

import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
    h, w, m = map(int, input().split())
    rows = defaultdict(int)
    cols = defaultdict(int)
    d1 = lambda :defaultdict(int)
    d2 = defaultdict(d1)
    m = map(int, read().split())
    ab = zip(m, m)
    for a, b in ab:
        rows[a-1] += 1
        cols[b-1] += 1
        d2[a-1][b-1] = 1
    rm = max(rows.values())
    cm = max(cols.values())
    rs = [i for i, v in rows.items() if v == rm]
    cs = [i for i, v in cols.items() if v == cm]
    r = rm + cm
    p = set()
    for rse in rs:
        for cse in cs:
            p.add(d2[rse][cse])
    r -= min(p)
    print(r)


if __name__ == '__main__':
    main()



### FIXED CODE ###

import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
    h, w, m = map(int, input().split())
    rows = defaultdict(int)
    cols = defaultdict(int)
    d1 = lambda :defaultdict(int)
    d2 = defaultdict(d1)
    m = map(int, read().split())
    ab = zip(m, m)
    for a, b in ab:
        rows[a-1] += 1
        cols[b-1] += 1
        d2[a-1][b-1] = 1
    rm = max(rows.values())
    cm = max(cols.values())
    rs = [i for i, v in rows.items() if v == rm]
    cs = [i for i, v in cols.items() if v == cm]
    r = rm + cm
    #p = set()
    for rse in rs:
        for cse in cs:
            if d2[rse][cse] == 0:
                print(r)
                sys.exit()
    print(r-1)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import bisect
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    L=[input() for i in range(N)]
    L.append(0)
    S=set()
    for i in L:
        for j in L:
            S.add(i+j)
    B=sorted(S)
    maxInt=0
    for i in B:
        if i>M:break
        idx=bisect.bisect(B,M-i)
        maxInt=max(maxInt,i+B[idx-1])
    print maxInt

### FIXED CODE ###

import bisect
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    L=[input() for i in range(N)]
    L.append(0)
    S=set(i+j for i in L for j in L)
    B=sorted(S)
    t=bisect.bisect(B,M)-1
    maxInt=max(i+B[bisect.bisect(B,M-i)-1] for i in B[:t])
    print maxInt
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

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

from fractions import gcd

l_gcd = [0 for _ in range(n)]
r_gcd = [0 for _ in range(n)]

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

ret = 1
for i in range(1,n+1):
    ret = max(ret,gcd(l_gcd[i-1],r_gcd[-1::-1][i+1]))
print(ret)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

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

from fractions import gcd

l_gcd = [0 for _ in range(n)]
r_gcd = [0 for _ in range(n)]

for i in range(n):
    l_gcd[i]=gcd(l_gcd[i-1],a[i])
for i in range(n-1,-1,-1):
    if i == n-1:
        r_gcd[i]=a[i]
    else:
        r_gcd[i]=gcd(r_gcd[i+1],a[i])
ret = 1

for i in range(n):
    if i==0:
        ret = max(ret,gcd(0,r_gcd[i+1]))
    elif i==n-1:
        ret = max(ret,gcd(l_gcd[i-1],0))
    else:
        ret = max(ret,gcd(l_gcd[i-1],r_gcd[i+1]))
print(ret)
### BUGGY CODE ###

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

limit = 10 ** 18

sum = 1
for i in range(N):
    sum *= AB[i]

if (limit < sum):
    print(-1)
else:
    print(sum)



### FIXED CODE ###

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

limit = 1000000000000000000

sum = 1
for i in range(N):
    if (limit < sum or sum == -1):
        sum = -1
    else:
        sum *= AB[i]
    if (AB[i] == 0):
        print(0)
        exit()

if (limit < sum):
    sum = -1

print(sum)
### BUGGY CODE ###

n = int(input())

words = {}

for i in range(n):
    key = input()
    if key not in words:
        words[key] = 0
    words[key] += 1

l = []

for i,j in words.items():
    if max(words.values()) == j:
        l.append(i)
l.sort()
for i in l:
    print(i)

### FIXED CODE ###

n = int(input())

words = {}

for i in range(n):
    key = input()
    if key not in words:
        words[key] = 0
    words[key] += 1

l = []
th = max(words.values())

for i,j in words.items():
    if th == j:
        l.append(i)

l.sort()

print(*l, sep="\n", end="")
### BUGGY CODE ###

import sys


def main():
    input = sys.stdin.readline
    n, q = [int(i) for i in input().split()]
    s = input()
    qs = [[int(i) for i in input().split()] for _ in range(q)]
    hoges = [False] + [s[i : i + 2] == "AC" for i in range(n - 1)]
    for (l, r) in qs:
        print(sum(hoges[l:r]))


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
from itertools import accumulate


def main():
    input = sys.stdin.readline
    n, q = [int(i) for i in input().split()]
    s = input().strip()
    qs = [[int(i) for i in input().split()] for _ in range(q)]
    hoges = [0] + [1 if s[i : i + 2] == "AC" else 0 for i in range(n - 1)]
    hoges = list(accumulate(hoges))
    for (l, r) in qs:
        print(hoges[r - 1] - hoges[l - 1])


if __name__ == "__main__":
    main()
### BUGGY CODE ###

import numpy as np
N,M = list(map(int,input().split()))
A = input().split()
 
count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)
 
L = (1 for i in range(N+1) for t in range(N+1) if i<t and (C[t] - C[i])%M==0)
print(len(list(L)))

### FIXED CODE ###

import collections
import numpy as np

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

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))
### BUGGY CODE ###

X = input()
while 1:
    if "ST" in X:
        X = X.replace("ST", "")
    else:
        break
##print(X)
print(len(X))

### FIXED CODE ###

X = input()
ans = len(X)
N = len(X)
cnt_s = 0
cnt_t = 0
for i in range(N):
    if X[i] == "S":
        cnt_s += 1
    if X[i] == "T":
        cnt_t += 1
    
    if i < N -1:
        if X[i] == "T" and X[i + 1] == "S":
            ans -= 2 * min(cnt_s, cnt_t)
            cnt_s -= min(cnt_s, cnt_t)
            cnt_t = 0
    if i == N - 1:
        ans -= 2 * min(cnt_s, cnt_t)
    
print(ans)
### BUGGY CODE ###

N,K = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
dist = [0]+[10**10]*(N+100)
for index,i in enumerate(h):
    for indh,j in enumerate(h[index+1:index+K+1]):
        dist[index+indh+1]=min(dist[index+indh+1],abs(j-i)+dist[index])

print(dist[N-1])


### FIXED CODE ###

N,K = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
dist = [0]+[10**10]*(N+100)
for index,i in enumerate(h):
    for indh,j in enumerate(h[index+1:index+K+1]):
        dist[index+indh+1]=min(dist[index+indh+1],abs(j-i)+dist[index])

print(dist[N-1])
### BUGGY CODE ###

def main():
    n, m, *abc = map(int, open(0).read().split())
    a = abc[:n]
    bc = abc[n:]
    for i, j in zip(*[iter(bc)] * 2):
        a += [j] * i

    a.sort()
    print(sum(a[-n:]))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from collections import Counter
    n, m, *abc = map(int, open(0).read().split())
    a = Counter(abc[:n])
    bc = abc[n:]
    for i, j in zip(*[iter(bc)] * 2):
        a[j] += i

    cnt = n
    ans = 0
    keys = list(a.keys())
    keys.sort(reverse=True)

    for k in keys:
        m = a[k]
        if m <= cnt:
            ans += k * m
            cnt -= m
        else:
            ans += k * cnt
            break

    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

N, Q = map(int, input().split())
S = input()

ans = []
for i in range(N):
    ans.append(S[:i+1].count('AC'))

for _ in range(Q):
    l, r = map(int, input().split())
    if l == 1:
        print(ans[r-1])
    else:
        b = ans[r-1]-ans[l-2]
        if S[l-1] != 'C' and S[r-1] != 'A':
            print(b)
        elif S[l-1] == 'C' and S[l-2] == 'A':
            print(b-1)


### FIXED CODE ###

N, Q = map(int, input().split())
S = input()

ans = [0]
num = 0
for x, y in zip(S[:-1], S[1:]):
    if x == 'A' and y == 'C':
        num += 1
        ans.append(num)
    else:
        ans.append(num)

for _ in range(Q):
    l, r = map(int, input().split())
    if l == 1:
        print(ans[r-1])
    else:
        b = ans[r-1]-ans[l-2]
        if S[l-1] == 'C' and S[l-2] == 'A':
            print(b-1)
        else:
            print(b)
### BUGGY CODE ###

N = int(input())
As = list(map(int,input().split()))
As.sort(reverse=True)
first_d = As[0]
def make_divisors(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)

    # divisors.sort()
    return divisors

if N == 2:
    print(max(As))
else:
    first = make_divisors(As[0])
    second = make_divisors(As[1])
    first_second = list(set(first) & set(second))
    third  = make_divisors(As[2])
    
    first_third = list(set(first) & set(third))

    second_third = list(set(third) & set(second))
    div_list = list((set(first) & set(second)) | (set(first) & set(third)) | (set(third) & set(second)))
    div_list.sort(reverse=True)
    
    for d in range(len(div_list)):
        cnt = 0
        for i in range(N):
            if As[i] % (div_list[d]) == 0:
                cnt += 1
        if cnt >= N-1:
            ans = div_list[d]
            break
    print(ans)

### FIXED CODE ###

N = int(input())
As = list(map(int,input().split()))
As.sort(reverse=True)
first_d = As[0]
def make_divisors(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)

    # divisors.sort()
    return divisors

if N == 2:
    print(max(As))
else:
    first = make_divisors(As[0])
    second = make_divisors(As[1])
    third  = make_divisors(As[2])
    div_list = list((set(first) & set(second)) | (set(first) & set(third)) | (set(third) & set(second)))
    div_list.sort(reverse=True)
    
    for d in range(len(div_list)):
        cnt = 0
        for i in range(N):
            if As[i] % (div_list[d]) != 0:
                cnt += 1
                if cnt > 1:
                    break
        if cnt <= 1 :
            ans = div_list[d]
            break
    print(ans)
### BUGGY CODE ###

N = int(input())
A_list = list(map(int, input().split(' ')))
count_list = [A_list.count(i) for i in range(N+1)]

sum_ = 0
for count in count_list:
  sum_ += (count**2 - count) // 2

for i in range(N):
  num = A_list.count(A_list[i])
  ans = sum_ - (num**2-num)//2 + (num**2-3*num+2)//2
  print(ans)

### FIXED CODE ###

import collections

N = int(input())
A_list = list(map(int, input().split(' ')))
count_dict = collections.Counter(A_list)

sum_ = 0
for count in count_dict.values():
  sum_ += (count**2 - count) // 2

for A in A_list:
  print(sum_ - count_dict[A] + 1)
### BUGGY CODE ###

n,m=map(int,input().split())
A=[]
for i in range(n):
    a,b=map(int,input().split())
    A.append([a,b])
A=sorted(A, key=lambda x:(x[0], -x[1]))
from collections import deque
A=deque(A)

import numpy as np
ans=0
now=[]
for nouki in range(1,m+1):
    while A:
        a,b=A.popleft()
        if a>nouki: A.appendleft([a,b]);break
        now.append(b)
    #print(nouki, now)
    if now==[]:continue
    m=np.max(now)
    ans+= m
    now[np.argmax(now)]=0
    

print(ans)
    


### FIXED CODE ###

n,m=map(int,input().split())
A=[]
for i in range(n):
    a,b=map(int,input().split())
    A.append([a,b])
A=sorted(A, key=lambda x:(x[0], -x[1]))
from collections import deque
A=deque(A)

# import numpy as np
import bisect as bi
ans=0
now=[]
for nouki in range(1,m+1):
    while A:
        a,b=A.popleft()
        if a>nouki: A.appendleft([a,b]);break
        bi.insort(now,b)
    #print(nouki, now)
    if now==[]:continue
    ans+= now[-1]
    del now[-1]


print(ans)
### BUGGY CODE ###

N = int(input())
ans = N+1
for i in range(1,N):
    stra = str(i)
    strb = str(N-i)
    a = ''
    b = ''
    for j in range(len(stra)):
        a += stra[j]+'+'
    a = a[:-1]
    for j in range(len(strb)):
        b += strb[j]+'+'
    b = b[:-1]
    ans = min(ans,eval(a)+eval(b))
print(ans)

### FIXED CODE ###

N = int(input())
ans = N+1
for i in range(1,N//2+1):
    stra = str(i)
    strb = str(N-i)
    a = ''
    b = ''
    for j in range(len(stra)):
        a += stra[j]+'+'
    a = a[:-1]
    for j in range(len(strb)):
        b += strb[j]+'+'
    b = b[:-1]
    ans = min(ans,eval(a)+eval(b))
print(ans)
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

if reduce(gcd, A) != 1:
    print("not coprime")
    exit()
ma = max(A)
p = list(range(ma+1))

for x in range(2, int(ma ** 0.5) + 1):
    if p[x]:
        # xは素数，それがpの要素にあるうちは続ける
        for i in range(2 * x, ma + 1, x):
            p[i] = x

s = [set() for _ in range(N)]
t = set()

for i, x in enumerate(A):
    while x != 1:
        s[i].add(x)
        t.add(x)
        # 割り続けるとs[i]にその素数がたまっていく
        x //= p[x]
l = sum(len(x) for x in s)
print("pairwise coprime" if l == len(t) else "setwise coprime")


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

if reduce(gcd, A) != 1:
    print("not coprime")
    exit()
ma = max(A)
p = list(range(ma+1))

for x in range(2, int(ma ** 0.5) + 1):
    if p[x]:
        # xは素数，それがpの要素にあるうちは続ける
        for i in range(2 * x, ma + 1, x):
            p[i] = x

s = [set() for _ in range(N)]
t = set()

for i, x in enumerate(A):
    while x != 1:
        s[i].add(x)
        t.add(x)
        # 割り続けるとs[i]にその素数がたまっていく
        x //= p[x]
l = sum(len(x) for x in s)
print("pairwise coprime" if l == len(t) else "setwise coprime")