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

from sys import stdin
from collections import defaultdict 
# from bisect import *
# from heapq import *
# import math
# mod = 10**9+7

N = input()
A = list(map(int, input().split()))
M = 10**6+1
ps = []
is_p = [True] * M
for i in range(2, M):
    if is_p[i]:
        ps.append(i)
        j = i + i
        while j < M:
            is_p[j] = False
            j += i
for p in ps:
    cnt = 0
    for a in A:
        if a % p == 0:
            cnt += 1
    if cnt > 1:
        break
else:
    print("pairwise coprime")
    exit()
gcd = lambda x, y : x if y == 0 else gcd(y, x % y)
x = A[0]
for a in A[1:]:
    x = gcd(x, a)
if x == 1:
    print("setwise coprime")
else:
    print("not coprime")

### FIXED CODE ###

from sys import stdin
from collections import defaultdict 
# from bisect import *
# from heapq import *
# import math
# mod = 10**9+7

N = input()
A = list(map(int, input().split()))
M = 10**6+1
spf = [i for i in range(M)]
for i in range(2, M):
    if spf[i] == i:
        for j in range(i+i, M, i):
            spf[j] = i
cnt = defaultdict(int)
for a in A:
    ps = set()
    while a != 1:
        ps.add(spf[a])
        a = a // spf[a]
    for p in ps:
        cnt[p] += 1
if all([x < 2 for x in cnt.values()]):
    print("pairwise coprime")
    exit()
gcd = lambda x, y : x if y == 0 else gcd(y, x % y)
x = A[0]
for a in A[1:]:
    x = gcd(x, a)
if x == 1:
    print("setwise coprime")
else:
    print("not coprime")
### BUGGY CODE ###

import heapq

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

heapq.heapify(A)

for m in range(M):
    B, C = map(int, input().split())
    for b in range(B):
        x = heapq.heappop(A)
        x = max(x, C)
        heapq.heappush(A, x)

print(sum(A))


### FIXED CODE ###

import heapq

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

change = []
for m in range(M):
    B, C = map(int, input().split())
    change.append((B, C))
change.sort(key=lambda x: -x[1])

change2 = []
for c in change:
    change2.extend([c[1]] * c[0])
    if len(change2) >= N:
        change2 = change2[:N]
        break


heapq.heapify(A)

for c in change2:
    x = heapq.heappop(A)
    if x >= c:
        # 先頭すでに十分大きい場合は抜ける
        heapq.heappush(A, x)
        break
    else:
        x = max(x, c)
        heapq.heappush(A, x)

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

n = int(input())
S = input()
count = 0
answer = n - 1
for i in range(n):
    count = S[:i].count('W') + S[i + 1:].count('E')
    answer = min(answer, count)
    count = 0

print(answer)


### FIXED CODE ###

n = int(input())
S = input()
e_sum = [0] * n
w_sum = [0] * n
ew_sum = [0] * n
for i in range(2, n + 1):
    e_sum[-i] = e_sum[-i + 1] + 1 if S[-i + 1] == 'E' else e_sum[-i + 1]
    ew_sum[-i] = e_sum[-i]
for i in range(1, n):
    w_sum[i] = w_sum[i - 1] + 1 if S[i - 1] == 'W' else w_sum[i - 1]
    ew_sum[i] += w_sum[i]

print(min(ew_sum))
### BUGGY CODE ###

# coding:utf-8


INF = float('inf')


def inpl(): return list(map(int, input().split()))


N, K = inpl()

A = [i + 1 for i in range(N)]

ans = 0
for a in A:
    if (2 * a) % K != 0: continue
    if a == K:
        mod = 0
    elif a > K:
        mod = abs(K - a) % K
    else:
        mod = a
    X = [x for x in A if (x + mod) % K == 0]
    if a in X: ans += len(X) ** 2
print(ans)

### FIXED CODE ###

# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


n, k = LI()

if k % 2 == 1:
    print((n // k) ** 3)
else:
    print((n // k) ** 3 + (((n // (k // 2)) - (n // k)) ** 3))
### BUGGY CODE ###


N, Q = map(int, input().split())
S = input()
lrs = [list(map(int, input().split())) for _ in range(Q)]

length = len(lrs)
count = [0] * length
for i in range(len(S) - 1):
    if S[i] != 'A':
        continue
    if S[i+1] != 'C':
        continue
    for j in range(length):
        lrsj = lrs[j]
        if lrsj[0] <= i+1 and i < lrsj[1] and i+1 != lrsj[1]:
            count[j] += 1

for c in count:
    print(c)


### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
lrs = [list(map(int, input().split())) for _ in range(Q)]

cs = [0] * N
s = 0
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        s += 1
    cs[i+1] = s 

for l, r in lrs:
    print(cs[r-1] - cs[l-1])
### BUGGY CODE ###

import copy
 
n, t = map(int, input().split())
L = [int(i) for i in input().split()]
LL = copy.deepcopy(L)
LL.sort()
 
minvalue = L[0]
maxvalue = max(LL)
subt = 0
count = 1
flag = 0
for i in range(n-1):
  if minvalue > L[i]:
    minvalue = L[i]
    flag = 1
  LL.remove(L[i])
  if maxvalue == L[i]:
    maxvalue = LL[-1]
  tsubt = maxvalue - minvalue
  if tsubt > subt:
    subt = tsubt
    count = 1
  elif tsubt == subt and flag == 1:
    count += 1
  flag = 0
#  print("L[i]:{0}, min:{1}, max:{2}, subt:{3}, count:{4}".format(L[i], minvalue, maxvalue, subt, count))
 
print(count)

### FIXED CODE ###

import copy
 
n, t = map(int, input().split())
L = [int(i) for i in input().split()]

LL = [[0] for i in range(n)]
tmax = L[-1]
for i in range(n):
  if tmax <= L[-i-1]:
    tmax = L[-i-1]
  LL[-i-1] = tmax
 
minvalue = L[0]
maxvalue = LL[0]
subt = 0
count = 1
flag = 0
flagg = 0
j = 0
for i in range(n-1):
  if minvalue > L[i]:
    minvalue = L[i]
    flag = 1
  
  maxvalue = LL[i]
 
  #if maxvalue == L[i]:
    #LL = LL[i-j+1:]
    #maxvalue = max(LL)
    #j = i+1
 
  tsubt = maxvalue - minvalue
  if tsubt > subt:
    subt = tsubt
    count = 1
  elif tsubt == subt and flag == 1:
    count += 1
  flag = 0
  #print("L[i]:{0}, min:{1}, max:{2}, subt:{3}, count:{4}".format(L[i], minvalue, maxvalue, subt, count))
 
print(count)
### BUGGY CODE ###

m = 10**9+7
def inv(x):
  m = 10**9+7
  t = x
  y = 1
  while True:
    if t == 1:
      break
    y *= m // t
    t = m % t
    y *= -1
    y %= m
  return y
import math
def cc(x,y):
  ans = 1
  for i in range(y):
    ans *= (x-i) * inv(y-i)
    ans %= m
  return ans
n,a,b,c = map(int,input().split())
d = 100 - c
awin = a * inv(d)
bwin = b * inv(d)
asc = 0
bsc = 0
for i in range(n):
  p = cc(n-1+i,i) * awin**(n-1) * bwin**i * (n+i)
  asc += p
  asc %= m
for i in range(n):
  p = cc(n-1+i,i) * awin**i * bwin**(n-1) * (n+i)
  bsc += p
  bsc %= m
sc = asc * awin + bsc * bwin
sc %= m
scn = sc * 100 * inv(d)
scn %= m
print(scn)

### FIXED CODE ###

#18:04
n,a,b,c = map(int,input().split())
mod = 10 ** 9 + 7
def inv(x):
  ans = 1
  now = x
  while now != 1:
    ans *= mod // now + 1
    ans %= mod
    now = now - mod % now
  return ans
p = (a * inv(a+b)) % mod
q = (b * inv(a+b)) % mod
taka = 0
aoki = 0
tcom = 1
acom = 1
for i in range(n):
  taka += tcom * (n+i)
  tcom *= n+i
  tcom *= inv(i+1)
  tcom *= q
  tcom %= mod
  aoki += acom * (n+i)
  acom *= n+i
  acom *= inv(i+1)
  acom *= p
  acom %= mod
for _ in range(n):
  taka *= p
  taka %= mod
  aoki *= q
  aoki %= mod
ans = taka + aoki
ans *= 100
ans *= inv(a+b)
ans %= mod
print(ans)
### BUGGY CODE ###

def aaa(n,m):
    count1 = 1
    count2 = 1
    l1 = [0]*n
    l2 = [0]*m
    if n % 2 == 1:
        count1 = count1 + n//2
        count2 = count2 + n//2 + 1
    else:
        count1 = count1 + n//2
        count2 = count2 + n//2
    if m % 2 == 1:
        count1 = count1 + m//2 + 1
        count2 = count2 + m//2
    else:
        count1 = count1 + m//2
        count2 = count2 + m//2
    l1.append(count1)
    l1.append(count2)
    l1 = l1 + l2
    return l1
s = list(input())
j = 0
a = 0
b = 0
l = []
for i in range(len(s)):
    if s[i] == "R" and j == 0:
        a = a + 1
    elif s[i] == "R" and j == 1:
        l = l + aaa(a-1,b-1)
        a = 1
        b = 0
        j = 0
    else:
        b = b + 1
        j = 1
l = l + aaa(a-1,b-1)
for x in l:
    print(x,end=" ")

### FIXED CODE ###

def aaa(n,m):
    count1 = 1
    count2 = 1
    if n % 2 == 1:
        count1 = count1 + n//2
        count2 = count2 + n//2 + 1
    else:
        count1 = count1 + n//2
        count2 = count2 + n//2
    if m % 2 == 1:
        count1 = count1 + m//2 + 1
        count2 = count2 + m//2
    else:
        count1 = count1 + m//2
        count2 = count2 + m//2
    l3 = [count1,count2]
    return l3
s = list(input())
n = len(s)
j = 0
a = 0
b = 0
l = [0]*n
for i in range(len(s)):
    if s[i] == "R" and j == 0:
        a = a + 1
    elif s[i] == "R" and j == 1:
        l[c-1] = aaa(a-1,b)[0]
        l[c] = aaa(a-1,b)[1]
        a = 1
        b = 0
        j = 0
    elif s[i] == "L" and j == 0:
        j = 1
        c = i
    elif s[i] == "L" and j == 1:
        b = b + 1
l[c-1] = aaa(a-1,b)[0]
l[c] = aaa(a-1,b)[1]
for x in l:
    print(x,end=" ")
### BUGGY CODE ###

A, B, C, K = map(int, input().split())

tmpA = A
tmpB = B
tmpC = C

for i in range(K):
    A = tmpB + tmpC
    B = tmpA + tmpC
    C = tmpA + tmpB
    
    tmpA = A
    tmpB = B
    tmpC = C

if A-B >= 10000000000000000000:
    print('Unfair')
else:
    print(A-B)

### FIXED CODE ###

A, B, C, K = map(int, input().split())


if K % 2 == 0:
    print(A-B)
else:
    print(B-A)
### BUGGY CODE ###

import sys
from heapq import heappush, heappop

inf = float('inf')

n, m = map(int, sys.stdin.readline().split())
g = [[] for _ in range(n+1)]
for _ in range(m):
    u, v = map(int, sys.stdin.readline().split())
    g[u].append(v)

s, t = map(int, sys.stdin.readline().split())

g2 = [[] for _ in range(n + 1)]
def after_cand(u):
    hq = [(0, u)]
    visited = set()
    dist = [inf] * (n + 1)
    while hq:
        d, x = heappop(hq)
        if x in visited and d == dist[x]:
            continue
        dist[x] = d
        visited.add(x)
        if d == 3:
            g2[u].append(x)
            continue
        for y in g[x]:
            heappush(hq, (d+1, y)) 

def main():
    for u in range(1, n+1):
        after_cand(u)

    hq = [(0, s)]
    dist = [inf] * (n + 1)
    while hq:
        d, x = heappop(hq)
        if dist[x] != inf:
            continue
        dist[x] = d
        for y in g2[x]:
            if dist[y] == inf:
                heappush(hq, (d+1, y))
    
    return dist[t] if dist[t] != inf else -1

if __name__ == '__main__':
    ans = main()
    print(ans)

### FIXED CODE ###

import sys
from heapq import heappush,heappop

inf = float('inf')

n, m = map(int, sys.stdin.readline().split())
g = [[] for _ in range(n+1)]
for _ in range(m):
    u, v = map(int, sys.stdin.readline().split())
    g[u].append(v)

s, t = map(int, sys.stdin.readline().split())

def main():
    dist = [inf] * (n + 1)
    can_reach = [[False] * 3 for _ in range(n + 1)]
    hq = [(0, s)]
    can_reach[s][0] = True
    while hq:
        d, x = heappop(hq)
        if d % 3 == 0:
            dist[x] = min(dist[x], d // 3)
        d += 1
        for y in g[x]:
            if not can_reach[y][d%3]:
                can_reach[y][d%3] = True
                heappush(hq, (d, y))

    return dist[t] if dist[t] != inf else -1

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

from collections import deque
INF = 20 * 20 + 1

def main():
    H, W = map(int, input().split())
    maze = [list(input()) for _ in range(H)]
    
    ans = 0
    for hs in range(H):
        for ws in range(W):
            if maze[hs][ws] == '#':
                continue
            goal_dists = [[-1 for _ in range(W+2)] for _ in range(H)]
            goal_dists = [[-1 for _ in range(W+2)]] + goal_dists + [[-1 for _ in range(W+2)]]
            for h in range(H):
                for w in range(W):
                    if maze[h][w] == '#':
                        goal_dists[h+1][w+1] = -1
                    else:
                        goal_dists[h+1][w+1] = INF
            goal_dists[hs+1][ws+1] = 0
            d = deque([[hs+1, ws+1]])
            while len(d) > 0:
                ht, wt = d.popleft()
                dist = goal_dists[ht][wt]
                for dh, dw in [[0, 1], [0, -1], [1, 0], [-1, 0]]:
                    if goal_dists[ht+dh][wt+dw] == -1:
                        continue
                    if goal_dists[ht+dh][wt+dw] > dist:
                        goal_dists[ht+dh][wt+dw] = dist + 1
                        d.append([ht+dh, wt+dw])
            
            max_dist = 0
            for h in range(1, H+2):
                for w in range(1, W+2):
                    if goal_dists[h][w] == INF:
                        continue
                    max_dist = max(max_dist, goal_dists[h][w])
            ans = max(ans, max_dist)
    
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import deque
import copy
INF = 20 * 20 + 1

def main():
    H, W = map(int, input().split())
    maze = [list(input()) for _ in range(H)]

    ans = 0
    goal_base = [[-1 for _ in range(W+2)] for _ in range(H)]
    goal_base = [[-1 for _ in range(W+2)]] + goal_base + [[-1 for _ in range(W+2)]]
    for h in range(H):
        for w in range(W):
            if maze[h][w] == '#':
                goal_base[h+1][w+1] = -1
            else:
                goal_base[h+1][w+1] = INF

    for hs in range(H):
        for ws in range(W):
            if maze[hs][ws] == '#':
                continue

            goal_dists = copy.deepcopy(goal_base)
            goal_dists[hs+1][ws+1] = 0
            d = deque([[hs+1, ws+1]])
            while len(d) > 0:
                ht, wt = d.popleft()
                dist = goal_dists[ht][wt]
                for dh, dw in [[0, 1], [0, -1], [1, 0], [-1, 0]]:
                    if goal_dists[ht+dh][wt+dw] == INF:
                        goal_dists[ht+dh][wt+dw] = dist + 1
                        d.append([ht+dh, wt+dw])
            
            max_dist = [goal_dists[h][w] for w in range(1, W+2) for h in range(1, H+2) if goal_dists[h][w] != INF]
            ans = max(ans, max(max_dist))

    print(ans)

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

from collections import deque
import numpy as np
def main():
    H, W = list(map(int, input().split()))
    A = np.array([['#'] * (W + 2)] + [['#', ] + list(input()) + ['#', ] for _ in range(H)] + [['#'] * (W + 2)])
    DXY = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    ans = 0
    INF = 10000
    for h in range(1, H + 1):
        for w in range(1, W + 1):
            if A[h, w] == '#':
                continue
            count = np.where(A == '.', INF, -1)
            count[h, w] = 0
            stack = deque([[h, w], ])
            visited = [[0] * W for _ in range(H)]
            while stack:
                x, y = stack.popleft()
                if visited[x - 1][y - 1] == 1:
                    continue
                else:
                    visited[x - 1][y - 1] = 1
                for (dx, dy) in DXY:
                    X = x + dx
                    Y = y + dy
                    if A[X][Y] == '.':
                        if visited[X - 1][Y - 1] == 0:
                            stack.append([X, Y])
                        count[X, Y] = min(count[X, Y], count[x, y] + 1)
            ans = max(ans, np.max(count))
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import deque
import itertools
def main():
    H, W = list(map(int, input().split()))
    A = [['#'] * (W + 2)] + [['#', ] + list(input()) + ['#', ] for _ in range(H)] + [['#'] * (W + 2)]
    DXY = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    ans = 0
    INF = 10000
    for h in range(1, H + 1):
        for w in range(1, W + 1):
            if A[h][w] == '#':
                continue
            count = [[-1 if i == '#' else INF for i in a] for a in A]
            count[h][w] = 0
            stack = deque([[h, w], ])
            visited = [[0] * W for _ in range(H)]
            while stack:
                x, y = stack.popleft()
                if visited[x - 1][y - 1] == 1:
                    continue
                else:
                    visited[x - 1][y - 1] = 1
                for (dx, dy) in DXY:
                    X = x + dx
                    Y = y + dy
                    if A[X][Y] == '.':
                        if visited[X - 1][Y - 1] == 0:
                            stack.append([X, Y])
                        count[X][Y] = min(count[X][Y], count[x][y] + 1)
            count = list(itertools.chain.from_iterable(count))
            ans = max(ans, max(count))
    print(ans)

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

import sys
import math
from bisect import bisect_right
def main():
    N,M = map(int,input().split())
    Marray=[(0,0)] * M
    P={}
    for i in range(M):
        s = input().split()
        p=int(s[0])
        y=s[1]
        #print(s)
        if p in P.keys():
            P[p]+=y+","
        else:
            P[p]=y+","
        Marray[i]=(p,int(y))
        #print(P[p])
        
    for key in P:
        string=P[key]
        
       # print(str)
        sp=string.split(",")
        de=len(sp)-1
        del sp[de]
        #print(sp)
        tmp=sorted(sp,key=int)
        list = [int(s) for s in tmp]
        P[key]=list
        
        #print(P[key])
    
    for index,value in Marray:
        list=P[index]
        
        #print(list)
        result=bisect_right(list,value)
        result=str(result)
        index=str(index)
        index_zero = index.zfill(6)
        result_zero = result.zfill(6)
        print(index_zero,result_zero,sep='')



if __name__ == "__main__":
    main()







### FIXED CODE ###

import sys
import math
from bisect import bisect_right
def main():
    N,M = map(int,input().split())
    Marray=[(0,0)] * M
    P={}
    for i in range(M):
        s = input().split()
        p=int(s[0])
        y=s[1]
        #print(s)
        if p in P.keys():
            P[p].append(int(y))
        else:
            P[p]=[]
            P[p].append(int(y))
        Marray[i]=(p,int(y))
        #print(P[p])
        
    for key in P:
        #string=P[key]
        
       # print(str)
        #sp=string.split(",")
        #de=len(sp)-1
        #del sp[de]
        #print(sp)
        tmp=sorted(P[key],key=int)
        #int_list=list(map(int,tmp))
        P[key]=tmp
        
        #print(P[key])
    
    for index,value in Marray:
        List=P[index]
        
        #print(list)
        result=bisect_right(List,value)
        result=str(result)
        index=str(index)
        index_zero = index.zfill(6)
        result_zero = result.zfill(6)
        print(index_zero,result_zero,sep='')



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

N=int(input())
S=input()
a=S.count('R')
b=S.count('G')
c=S.count('B')
ans=a*b*c
for i in range(N):
  for j in range(i+1,N-1):
    if S[i]!=S[j]:
      if (2*j-i)<=N-1:
        if S[i]!=S[2*j-i]!=S[j]:
          ans-=1
print(ans)

### FIXED CODE ###

N=int(input())
S=input()
a=S.count('R')
b=S.count('G')
c=S.count('B')
ans=a*b*c
for i in range(N-2):
  for j in range(i+1,N-1):
    if S[i]!=S[j]:
      if (2*j-i)<=N-1 and S[i]!=S[2*j-i]!=S[j]:
        ans-=1     
print(ans)
### BUGGY CODE ###

a, b, k = map(int, input().split())

for i in range(k):
    if a > 0:
        a -= 1
    elif b > 0:
        b -= 1

print(a, b)


### FIXED CODE ###

a, b, k = map(int, input().split())

if a > k:
    print(a-k, b)
elif a + b > k:
    print(0, a + b - k)
else:
    print(0, 0)
### BUGGY CODE ###

from copy import deepcopy

n, U, V = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n - 1)]
U -= 1
V -= 1

g = [[] for _ in range(n)]
for a, b in ab:
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

WHITE = 0
GRAY = 1
BLACK = 2

color = [WHITE] * n
d = [-1] * n
f = [-1] * n
p = [-1] * n
t = 0


def dfs(s):
    if color[s] == BLACK:
        return
    global t
    stack = [s]
    color[s] = GRAY
    d[s] = t
    t += 1
    while stack:
        u = stack[-1]
        for v in g[u]:
            if color[v] == WHITE:
                color[v] = GRAY
                d[v] = t
                p[v] = u
                t += 1
                stack.append(v)
                break
        else:
            color[u] = BLACK
            f[u] = t
            t -= 1
            stack.pop()

dfs(V)
d_cp = deepcopy(d)

color = [WHITE] * n
d = [-1] * n
f = [-1] * n
p = [-1] * n
t = 0
dfs(U)

ans = 0
for cpe, de in zip(d_cp, d):
    if cpe > de:
        ans = max(ans, cpe - 1)

print(ans)


### FIXED CODE ###

from collections import deque


def bfs(s):
    d = [-1] * n
    p = [-1] * n
    dq = deque([s])
    d[s] = 0

    while dq:
        u = dq.popleft()
        for v in adj[u]:
            if d[v] == -1:
                d[v] = d[u] + 1
                p[v] = u
                dq.append(v)

    return d, p


n, takahashi, aoki = map(int, input().split())
takahashi -= 1
aoki -= 1
ab = [list(map(int, input().split())) for _ in range(n - 1)]

adj = [[] for _ in range(n)]
for a, b in ab:
    a -= 1
    b -= 1
    adj[a].append(b)
    adj[b].append(a)

depth, par = bfs(takahashi)
aoki_move = depth[aoki] // 2 + 1
root = aoki
for _ in range(aoki_move):
    child = root
    root = par[root]

adj[child].remove(root)
adj[root].remove(child)

depth2, par2 = bfs(root)

aoki_move += max(depth2) - 1
print(aoki_move)
### BUGGY CODE ###

import math
from math import gcd
n = int(input())
a = list(map(int, input().split()))
a.sort()
used = [False] * (10**6+1)

def sieve_of_erastosthenes(num):
    input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
    input_list[0] = input_list[1] = False
    input_list[2] = input_list[3] = input_list[5] = True
    sqrt = math.sqrt(num)

    for serial in range(3, num, 2):

        if serial >= sqrt:
            return input_list

        for s in range(serial ** 2, num, serial): 
            input_list[s] = False

input_list = sieve_of_erastosthenes(10**6+1)
prime_list = [i for i, b in enumerate(input_list) if b == True]

def factorization(n):
    arr = []
    temp = n
    for i in prime_list:
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)
    if temp!=1:
        arr.append(temp)
    if arr==[]:
        arr.append(n)
    return arr

g = a[0]
arr = factorization(a[0])
for i in arr:
    used[i] = True

pair = True
for i in range(n-1):
    g = gcd(g, a[i+1])
    # 一度でも互いに素でない組合せが出たらpariwise coprimeではない
    arr = factorization(a[i+1])
    for i in arr:
        if i == 1: continue
        if used[i]: pair=False
        used[i] = True
if g > 1:
    print('not coprime')
    exit(0)
if not pair:
    print('setwise coprime')
    exit(0)
else:
    print('pairwise coprime')


### FIXED CODE ###

import math
import sys
import random

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

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

def sieve_of_erastosthenes(num):
    input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
    input_list[0] = input_list[1] = False
    input_list[2] = input_list[3] = input_list[5] = True
    sqrt = math.sqrt(num)

    for serial in range(3, num, 2):

        if serial >= sqrt:
            return input_list

        for s in range(serial ** 2, num, serial): 
            input_list[s] = False

input_list = sieve_of_erastosthenes(10**6+1)
prime_list = [i for i, b in enumerate(input_list) if b == True]

def factorization(n):
    arr = []
    temp = n
    for i in prime_list:
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)
    if temp!=1:
        arr.append(temp)
    if arr==[]:
        arr.append(n)
    return arr
random.shuffle(a)
g = a[0]
arr = factorization(a[0])
used = set()
for i in arr:
    if i == 1: continue
    used.add(i)

# not coprimeか判定
for i in range(n-1):
    g = gcd(g, a[i+1])
if g > 1:
    print('not coprime')
    exit(0)

# pairwise coprimeか判定
used = [0] * (10**6+1)
pair = True
for _a in a:
    if _a == 1:
        continue
    if used[_a]:
        print('setwise coprime')
        exit(0)
    else:
        used[_a] = True

for p in prime_list:
    v = p
    cnt = 0
    while v < 10**6+1:
        if used[v]:
            cnt+=1
        v += p
    if cnt > 1:
        print('setwise coprime')
        exit(0)
print('pairwise coprime')