We have N integers. The i-th number is A_i.
\{A_i\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\leq i < j \leq N.
\{A_i\} is said to be setwise coprime when \{A_i\} is not pairwise coprime but GCD(A_1,\ldots,A_N)=1.
Determine if \{A_i\} is pairwise coprime, setwise coprime, or neither.
Here, GCD(\ldots) denotes greatest common divisor.

-----Constraints-----
 - 2 \leq N \leq 10^6
 - 1 \leq A_i\leq 10^6

-----Input-----
Input is given from Standard Input in the following format:
N
A_1 \ldots A_N

-----Output-----
If \{A_i\} is pairwise coprime, print pairwise coprime; if \{A_i\} is setwise coprime, print setwise coprime; if neither, print not coprime.

-----Sample Input-----
3
3 4 5

-----Sample Output-----
pairwise coprime

GCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.

Difficulty: interview

Starter code:

Solutions:
from math import gcd

N = int(input())
num_lis = list(map(int, input().split()))
c = True

def osa_k(max_num):
  lis = [i for i in range(max_num+1)]
  p = 2
  while p**2 <= max_num:
    if lis[p] == p:
      for q in range(2*p, max_num+1, p):
        if lis[q] == q:
          lis[q] = p
    p += 1
  return lis

hoge = 0
for i in num_lis:
  hoge = gcd(hoge, i)
if hoge > 1:
  print("not coprime")
  return

d_lis = osa_k(10**6+10)
tmp = set()
for i in num_lis:
  num = i
  new_tmp = set()
  while num > 1:
    d = d_lis[num]
    new_tmp.add(d)
    num //= d
  for j in new_tmp:
    if j in tmp:
      c = False
      break
    else:
      tmp.add(j)
  else:
    continue
  break

if c:
  print("pairwise coprime")
else:
  print("setwise coprime")

n=int(input())
l=list(map(int,input().split()))
m=max(l)

from math import gcd
g=gcd(l[0],l[1])
for i in range(2,n):
  g=gcd(g,l[i])
if g!=1:
  print('not coprime')
  return

prime=[True]*(m+1)
prime[0]=False
prime[1]=False
d=[0]*(m+1)
for i in range(2,int(m**0.5)+1):
  if prime[i]:
    for j in range(i*2,m+1,i):
      prime[j]=False
      d[j]=i
s=[i for i in range(m+1) if prime[i]]
for ss in s:
  d[ss]=ss

sl=set()
for i in range(n):
  div=set()
  ll=l[i]
  while ll>1:
    div.add(d[ll])
    ll//=d[ll]
  div=list(div)
  for dd in div:
    if dd not in sl:
      sl.add(dd)
    else:
      print('setwise coprime')
      return

print('pairwise coprime')

import sys


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


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


input()
A = LI()

g = 0
for a in A:
    g = gcd(g, a)
if g != 1:
    print("not coprime")
    return

sosudayo = [True] * 1100000
sosudayo[0] = False
sosudayo[1] = False
for i in range(2, 1100000):
    if not sosudayo[i]:
        continue
    for j in range(i*i, 1100000, i):
        sosudayo[j] = False

used = [False] * 1100000
sosu = [a for a in A if sosudayo[a]]
for i in sosu:
    used[i] = True
ruto_sosu = [a for a in range(1100) if sosudayo[a]]
not_sosu = [a for a in A if not sosudayo[a]]

for i in not_sosu:
    for j in ruto_sosu:
        if i == 1:
            break
        if i % j != 0:
            continue
        if used[j]:
            print("setwise coprime")
            return
        used[j] = True
        while i % j == 0:
            i //= j
    if i > 1:
        if used[i]:
            print("setwise coprime")
            return
        used[i] = True

print("pairwise coprime")


import sys
from math import gcd
input = lambda: sys.stdin.readline().rstrip()
n = int(input())
A = list(map(int, input().split()))
nowgcd = A[0]
# 全体のGCDを取る
for i in A:
    nowgcd = gcd(nowgcd, i)
if nowgcd != 1:
    print('not coprime')
    return

# osa_k法で前処理
MAXN = 10**6 + 5
sieve = [i for i in range(MAXN + 1)]
p = 2
while p * p <= MAXN:
    # まだチェックされていないなら
    if sieve[p] == p:
        # 次のqの倍数からp刻みでチェック入れていく
        for q in range(2 * p, MAXN + 1, p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1

check = set()
for a in A:
    tmp = set()
    while (a > 1):
        tmp.add(sieve[a])
        a //= sieve[a]
    for p in tmp:
        if p in check:
            print('setwise coprime')
            return
        check.add(p)
print('pairwise coprime')


#高速素因数分解  osa_k法 
def osa_k(a):
    tmp = set()
    while a > 1:
        tmp.add(sieve[a])
        a //= sieve[a]
    return tmp

    # 初期入力
import math
import sys
from bisect import bisect_left
from functools import reduce
input = sys.stdin.readline  #文字列では使わない
N = int(input())
A = list(map(int, input().split()))
used =set()

#not coprimeの判定
gcd_a =reduce(math.gcd,A)
if gcd_a !=1:
    ans ="not coprime"

#pairwise coprimeの判定
else:
    MAXN =10**6 +10
    #osa_k法
    sieve = [i for i in range(MAXN+1)]
    p = 2
    while p*p <= MAXN:
        if sieve[p] == p:
            for q in range(2*p,MAXN+1,p):
                if sieve[q] == q:
                    sieve[q] = p
        p += 1
    
    ans ="pairwise coprime"
    for a in A:
        aa =osa_k(a)
        if used & aa:
            ans ="setwise coprime"
            break #共通要素があったらpair_wではない→set_w
        used |=aa
    
print(ans)

N=int(input())
from math import gcd
from functools import reduce
l=list(map(int,input().split()))
sw=0
c=[0]*1000001
for i in l:
   c[i]+=1
if all(sum(c[i::i])<=1 for i in range(2,1000001)):
   print("pairwise coprime")
elif reduce(gcd,l)==1:
   print("setwise coprime")
else:
   print("not coprime")

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

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

g = 0

A.sort()

for item in A:
    g = gcc(g, item)

if g != 1:
    print("not coprime")
    return

primes = []

is_prime = [True] * 1100000

is_prime[0] = is_prime[1] = False

for i in range(2, 1100000):
    if not is_prime[i]:continue
    for j in range(i*i, 1100000, i):
        is_prime[j] = False

A_prime = [item for item in A if is_prime[item]]
A_notprime = [item for item in A if not is_prime[item]]

primes = [p for p in range(1100) if is_prime[p]]
used = [False] * 1100000

for item in A_prime:
    used[item] = True

for a in A_notprime:
    for p in primes:
        if a == 1:break
        if a % p != 0:continue

        if used[p]:
            print("setwise coprime")
            #互いに素でない（共通素因数pで割れる）ペアがAの中にあると，それはsetwise_coprime
            return

        used[p] = True

        while a % p == 0:
            a //= p

    if a > 1:
        if used[a]:
            print("setwise coprime")
            return
        used[a] = True


print("pairwise coprime")

from math import gcd
N = int(input())
A = list(map(int, input().split()))
MA = 10**6+10

g = 0
for a in A:
    g = gcd(g, a)
if g > 1:
    print('not coprime')
    return

sieve = [i for i in range(MA+1)]
p = 2
while p*p <= MA:
    if sieve[p] == p:
        for q in range(2*p, MA+1, p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1
prim = set()
for a in A:
    tmp = set()
    while a > 1:
        tmp.add(sieve[a])
        a //= sieve[a]
    for t in tmp:
        if t in prim:
            print('setwise coprime')
            return
        prim.add(t)

print('pairwise coprime')


import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

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

D = getD(max(A))
pairwise_coprime = True
use_divnum = set()
for i in range(N):
    k = A[i]
    while k != 1:
        if D[k] in use_divnum:
            pairwise_coprime = False
            break
        else:
            use_divnum.add(D[k])
        div = D[k]
        while k % div == 0 and k > 1:
            k = k // div
if pairwise_coprime: 
    print("pairwise coprime")
    return
from math import gcd
gcd_of_a = A[0]
for i in range(N):
    gcd_of_a = gcd(gcd_of_a, A[i])
if gcd_of_a == 1:
    print("setwise coprime")
else:
    print("not coprime")


import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

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

D = getD(max(A))
pairwise_coprime = True
use_divnum = set()
for k in A:
    while k != 1:
        if D[k] in use_divnum:
            pairwise_coprime = False
            break
        else:
            use_divnum.add(D[k])
        div = D[k]
        while k % div == 0 and k > 1:
            k = k // div

if pairwise_coprime:
    print('pairwise coprime')
    return

if reduce(math.gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


from math import gcd
from functools import reduce
N=int(input())
A=list(map(int,input().split()))

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

l=primes(max(A))
d=[0]*max(A)
for i in A:
  d[i-1]=1
if reduce(gcd,A)>1:
  print('not coprime')
elif all(sum(d[i-1::i])<=1 for i in l):
    print('pairwise coprime')
else:print('setwise coprime')

import fractions

N = int(input())
A = list(map(int, input().split()))
D = [i for i in range(10**6+1)]
a_gcd = 0
for a in A:
  a_gcd = fractions.gcd(a, a_gcd)
if a_gcd > 1:
  print('not coprime')
  return

for i in range(2, 10**3+1):
  if D[i] == i:
    for n in range(i, 10**6+1, i):
      if D[n] == n:
        D[n] = i

p_set = set()
for a in A:
  d_set = set()
  while a > 1:
    if not D[a] in d_set:
      if D[a] in p_set:
        print('setwise coprime')
        return
      p_set.add(D[a])
      d_set.add(D[a])
    a //= D[a]
print('pairwise coprime')


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


# number_to_prime[i]: i の最小の素因数, iが素数ならば0
number_to_prime = [0] * (10**6 + 1)

# preprocess
for i in range(2, 10**6+1):
    if not number_to_prime[i]:
        j = 1
        while j*i <= 10**6:
            number_to_prime[j*i] = i
            j += 1

def is_pair_copr(A):
    import numpy as np
    U = 1 << 20
    div_p = np.arange(U)
    for p in range(2, U):
        if div_p[p] != p:
            continue
        div_p[p::p] = p
    used = np.zeros(U, np.bool_)
 
    for x in A:
        while x > 1:
            p = div_p[x]
            while x % p == 0:
                x //= p
            if used[p]:
                return False
            used[p] = True
    return True

def is_pairwise():
    used_primes = set()
    pairwise_flag = 1
    for a in A:
        curr_primes = set()
        while a > 1:
            prime = number_to_prime[a]
            curr_primes.add(prime)
            a //= prime
        if used_primes & curr_primes:
            pairwise_flag = 0
            break
        else:
            used_primes = used_primes | curr_primes
    return pairwise_flag

def is_setwise(*A):
    import math
    from functools import reduce

    return reduce(math.gcd, A) == 1

if is_pair_copr(A):
    print("pairwise coprime")
elif is_setwise(*A):
    print("setwise coprime")
else:
    print("not coprime")

from math import gcd

N = int(input())
num_lis = list(map(int, input().split()))
c1 = True #setwise
c2 = True #pairwise

def osa_k(max_num):
  lis = [i for i in range(max_num+1)]
  p = 2
  while p**2 <= max_num:
    if lis[p] == p:
      for q in range(2*p, max_num+1, p):
        if lis[q] == q:
          lis[q] = p
    p += 1
  return lis

hoge = 0
for i in num_lis:
  hoge = gcd(hoge, i)
if hoge > 1:
  c1 = False

if c1:
  d_lis = osa_k(max(num_lis))
  tmp = set()
  for i in num_lis:
    num = i
    new_tmp = set()
    while num > 1:
      d = d_lis[num]
      new_tmp.add(d)
      num //= d
    for j in new_tmp:
      if j in tmp:
        c2 = False
        break
      else:
        tmp.add(j)
    else:
      continue
    break
else:
  c2 = False

if c2:
  print("pairwise coprime")
elif c1:
  print("setwise coprime")
else:
  print("not coprime")

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

maxV = (10 ** 6 + 1)

sieve = [i for i in range(maxV)]
p = 2

while p*p < maxV:
    if sieve[p] == p:
        for q in range(p*2, maxV, p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1

from math import gcd

g = 0
primes = set()
for a in A:
    g = gcd(g, a)

    v = a


if g > 1:
    print('not coprime')
    return

for a in A:
    temp_prime = set()
    while a > 1:
        prime = sieve[a]
        temp_prime.add(prime)
        a = a // prime

    for t in temp_prime:
        if t in primes:
            print('setwise coprime')
            return
        primes.add(t)

print('pairwise coprime')

import sys
from math import gcd


def osa_k(sieve, MAXN):
    p = 2
    while p * p <= MAXN:
        # まだチェックされていないなら
        if sieve[p] == p:
            # 次のqの倍数からp刻みでチェック入れていく
            for q in range(2 * p, MAXN + 1, p):
                if sieve[q] == q:
                    sieve[q] = p
        p += 1


input = lambda: sys.stdin.readline().rstrip()
n = int(input())
A = list(map(int, input().split()))
nowgcd = A[0]
# 全体のGCDを取る
for i in A:
    nowgcd = gcd(nowgcd, i)
if nowgcd != 1:
    print('not coprime')
    return

MAXN = 10**6 + 5
sieve = [i for i in range(MAXN + 1)]
p = 2
osa_k(sieve, MAXN)

check = set()
for a in A:
    tmp = set()
    while (a > 1):
        tmp.add(sieve[a])
        a //= sieve[a]
    for p in tmp:
        if p in check:
            print('setwise coprime')
            return
        check.add(p)
print('pairwise coprime')


# import itertools
import math
from functools import reduce
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
# import heapq
# from collections import deque

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

if gcd_list(A) > 1:
    print("not coprime")
    return


MAXN = 10**6+10
sieve = [i for i in range(MAXN+1)]
p = 2
while p*p <= MAXN:
    if sieve[p] == p:
        for q in range(2*p, MAXN+1, p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1

st = set()
for a in A:
    tmp = set()
    while a > 1:
        tmp.add(sieve[a])
        a //= sieve[a]
    for p in tmp:
        if p in st:
            print('setwise coprime')
            return
        st.add(p)
print('pairwise coprime')


N=int(input())
A=list(map(int,input().split()))
maxA=max(A)
count=[0]*(maxA+1)
for x in A:
    count[x]+=1
maxc=0
for i in range(2,maxA+1):
    maxc = max(maxc,sum(count[i::i]))

if maxc==N:
    print('not coprime')
elif maxc<=1:
    print('pairwise coprime')
else:
    print('setwise coprime')

n = int(input())
a = list(map(int, input().split()))
MAX_A = max(a)
divide_minimam_prime = [i for i in range(MAX_A + 1)]
is_prime = [True for i in range(MAX_A + 1)]
is_prime[0] = False
is_prime[1] = False
for div in range(2,int(MAX_A**0.5) + 1):
    if is_prime[div]:
        # divが素数だった場合
        k = div
        divide_minimam_prime[k] = k
        k += div
        while k <= MAX_A:
            is_prime[k] = False
            if divide_minimam_prime[k] == k:
                divide_minimam_prime[k] = div
            k += div
# pairwise coprimeであるかどうか？
pairwise_coprime = True
use_divnum = set()
for i in range(n):
    k = a[i]
    while k != 1:
        if divide_minimam_prime[k] in use_divnum:
            pairwise_coprime = False
            break
        else:
            use_divnum.add(divide_minimam_prime[k])
        div = divide_minimam_prime[k]
        while k % div == 0 and k > 1:
            k = k // div
if pairwise_coprime: 
    print("pairwise coprime")
    return
from math import gcd
gcd_of_a = a[0]
for i in range(n):
    gcd_of_a = gcd(gcd_of_a, a[i])
if gcd_of_a == 1:
    print("setwise coprime")
else:
    print("not coprime")

from functools import reduce
from math import gcd

P = [0, 0]+list(range(2, 1000))
for i in range(32):
    if P[i] == 0: continue
    P[2*i::i] = [0]*(-2--1000//i)
P = [p for p in P if p]

N = int(input())
A = [a for a in map(int, input().split()) if a>1]
i = N-len(A)

# N <= 78498

z = set()
y = 0
for a in A:
    x = 0
    for p in P:
        while a%p == 0:
            a //= p
            x |= 1
        x <<= 1
    if y&x: break
    y |= x
    if a>1:
        if a in z: break
        z.add(a)
else:
    print("pairwise coprime")
    return

if i or reduce(gcd, A) == 1: print("setwise coprime")
else: print("not coprime")

# -*- coding: utf-8 -*-


def main():
    from math import gcd
    import sys
    input = sys.stdin.readline

    n = int(input())
    a = list(map(int, input().split()))
    max_a = 10 ** 6
    numbers = [0 for _ in range(max_a + 1)]

    # KeyInsight:
    # 調和級数: 計算量 O(AlogA)
    # ◯: 素因数分解をすればよいことには気がつけた。
    # △: 4ケースWA・TLEが取れず
    for ai in a:
        numbers[ai] += 1

    is_pairwise = True

    # 素因数の判定
    # 素因数の倍数の要素を数えている
    for i in range(2, max_a + 1):
        count = 0

        for j in range(i, max_a + 1, i):
            count += numbers[j]

            # 2つ以上ある数の倍数があった場合は、少なくともpairwiseではない
            if count > 1:
                is_pairwise = False

    if is_pairwise:
        print("pairwise coprime")
        return

    value_gcd = 0

    # 全ての要素のGCDが1かどうかを判定
    for i in range(n):
        value_gcd = gcd(value_gcd, a[i])

        if value_gcd == 1:
            print("setwise coprime")
            return

    print("not coprime")


def __starting_point():
    main()

__starting_point()

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

c = [0]*(10**6 + 3)
for i in a:
    c[i] += 1

pairwise = True
for i in range(2,10**6+1):
    if sum(c[::i])>1:
        pairwise = False

g = 0
for i in a:
    g = math.gcd(g,i)
if g == 1:
    setwise = True
else:
    setwise = False

if pairwise == True:
    print("pairwise coprime")
elif setwise == True:
    print("setwise coprime")
else:
    print("not coprime")


from functools import reduce
from math import gcd

def sieve(L,R):
    if L<2:L=2
    flag=[0]*(2*R)
    for i in range(2, int(R**.5)+5):
        if flag[i] == 1:continue
        for j in range(i*2,R+i, i):
            if flag[j] == 1:continue
            if j % i == 0:
                flag[j] = 1
    
    return [i for i in range(L,R+1) if flag[i] == 0]
  
N=int(input())
*A,=map(int,input().split())

if N == 2:
  if gcd(A[0],A[1])==1:
    print('pairwise coprime')
  else:
    print('not coprime')
  return

primes = sieve(2,10**6+5)
num = [0]*(2*10**6+10)
for i in range(N):
  num[A[i]] += 1

flag=0
for p in primes:
  count=0
  for d in range(p,10**6+p+5,p):
    count += num[d]
  if count > 1:
    flag=1
    break
  
if flag==0:
  print('pairwise coprime')
elif reduce(gcd,A)==1:
  print('setwise coprime')
else:
  print('not coprime')

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def primeFactorization(n):
    D = list(range(n + 1))
    for i in range(2, int(n ** 0.5) + 1):
        if D[i] == i:
            for j in range(i, n + 1, i):
                if D[j] == j:
                    D[j] = i
    return D

def resolve():
    N = I()
    A = LI()

    # pairwise判定
    is_pc = True
    D = primeFactorization(max(A))
    pf = set()
    for i in A:
        tmp = i
        cnt = collections.Counter()
        while tmp != 1:
            cnt[D[tmp]] += 1
            tmp //= D[tmp]
        fact = set(cnt.keys())
        if pf & fact:
            is_pc = False
            break
        else:
            pf |= fact
    
    # setwise判定
    is_sc = False
    if not is_pc:
        gcd = A[0]
        for i in A[1:]:
            gcd = math.gcd(i, gcd)
        if gcd == 1:
            is_sc = True

    if is_pc:
        print('pairwise coprime')
    elif is_sc:
        print('setwise coprime')
    else:
        print('not coprime')

def __starting_point():
    resolve()

__starting_point()

from math import gcd
from functools import reduce

N, *A = list(map(int, open(0).read().split()))

t = [0] * (10 ** 6 + 1)
for a in A:
    t[a] += 1

for i in range(2, 10 ** 6 + 1):
    c = 0
    for j in range(i, 10 ** 6 + 1, i):
        c += t[j]
    if c > 1:
        break
else:
    print('pairwise coprime')
    return

if reduce(gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


N=int(input())
from math import gcd
from functools import reduce
l=list(map(int,input().split()))
sw=0
c=[0]*1000001
for i in l:
   c[i]+=1
if all(sum(c[i::i])<=1 for i in range(2,1000001)):
  print("pairwise coprime")
elif reduce(gcd,l)==1:
   print("setwise coprime")
else:
   print("not coprime")

# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 00:26:07 2020

@author: liang
"""

"""
コーナーケース１:
    重複があるとき　not coprime(※これが誤り)
    ただし、1の重複は除く

コーナーケース:
    重複があるとき　pairwise coprime ではない
    setwise coprimeの可能性はある
    ただし、１の重複は
"""
import math
C = 10**6
#T = int(math.sqrt(C)*10**3)+1
N = int(input())
judge = [0]+[False]*C
A =list()
f = True
for a in input().split():
    if judge[int(a)] == True and int(a) != 1:
        f = False
    judge[int(a)]=True
    A.append(int(a))
d = [False]+[True]*C

#print(judge[:10])
def solve(f):
    flag = True
    #エラトステネスの篩 O(N log N)
    for i in range(2,C+1):
        count = 0
        if d[i] == True:
            for j in range(i,C+1,i):
                if judge[j] == True:
                    count += 1
                if count == 2:
                    flag = False
                    break
                d[j] = False
        if not flag:
            break
    
    if flag == True and f == True:
        return "pairwise coprime"
    ans = A[0]
    #線形探索 O(N)
    for i in range(N):
        ans = math.gcd(ans,A[i])
    #print("ans",a)
    if ans == 1:
        return "setwise coprime"
    return "not coprime"

print((solve(f)))
#print(len(A))


import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

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

D = getD(max(A))

flag = True

d_set = set()
for a in A:
    while a != 1:
        d = D[a]
        if d in d_set:
            flag = False
            break
        else:
            d_set.add(d)
        while a > 1 and a % d == 0:
            a = a // d



if flag:
    print('pairwise coprime')
    return

if reduce(math.gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


from functools import reduce
from math import gcd

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

c=max(A)+1
D=[0]*c
div=[0]*c
P=[]

for i in range(2,c):
    if D[i]==0:
        P.append(i)
        D[i]=i
    for j in P:
        if i*j>=c  or j>D[i] :
           break
        D[i*j]=j
f=0
for i in A:
    if i==1:
        continue
    temp=i
    while temp!=1:
        if div[D[temp]]==1:
            f=1
            break
        div[D[temp]]+=1
        temp2=D[temp]
        while temp%temp2==0 and temp>=temp2:
            temp=temp//temp2
    if f==1:
        break
        
if f==0:
    print('pairwise coprime')

elif reduce(gcd, A) == 1:
    print('setwise coprime')

else:
    print('not coprime')

from math import gcd

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

prime = list(range(max(A) + 1))

for i in range(2, len(prime)):
    if prime[i] != i:
        continue
    for j in range(i, len(prime), i):
        if prime[j] != j:
            continue
        prime[j] = i

used = set()
pc = True
for a in A:
    used_this = set()
    while a != 1:
        div = prime[a]
        if div in used:
            pc = False
            break
        used_this.add(div)
        a //= div
    used.update(used_this)

if pc:
    print('pairwise coprime')
    return

buf = A[0]
for a in A[1:]:
    buf = gcd(buf, a)
if buf == 1:
    print('setwise coprime')
else:
    print('not coprime')

import math
from functools import reduce

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

def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)

        if prime > math.sqrt(limit):
            break

        P.append(prime)

        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1

    for a in A:
        P.append(a)

    return P

def factorization(n, D):
    arr = []
    temp = n
    for i in D:
        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


def gcd_list(numbers):
    return reduce(math.gcd, numbers)

def decomp(n, D):
    arr = []
    while n != 1:
        if D[n] not in arr:
            arr.append(D[n])
        n = n//D[n]
    return arr

D = [i for i in range(10**6+1)]

for i in range(2, 10**3+1):
  if D[i] == i:
    for n in range(i, 10**6+1, i):
      if D[n] == n:
          D[n] = i

s = set()
for i in a:
    for j in decomp(i, D):
        if j not in s:
            s.add(j)
        else:
            if gcd_list(a) == 1:
                print('setwise coprime')
                return
            else:
                print('not coprime')
                return

print('pairwise coprime')



from math import gcd
from functools import reduce
 
 
def facs(n):
    yield 2
    for x in range(3, n, 2):
        yield x
 
 
def main():
    input()  # N
    array = [int(x) for x in input().split()]
    MAX_A = 10 ** 6 + 1
    histogram = [0] * MAX_A
    for x in array:
        histogram[int(x)] += 1
 
    for divider in facs(MAX_A):
        count = sum(histogram[divider::divider])
        if count > 1:
            break
    else:
        return 'pairwise coprime'
 
    gcd_total = reduce(gcd, array)
    if gcd_total == 1:
        return 'setwise coprime'
    else:
        return 'not coprime'
 
 
def __starting_point():
    print(main())
__starting_point()

max_num = 10**6 + 1
prime = [i for i in range(max_num)]
r2_num = int(max_num**(1/2))+1
for i in range(2, r2_num):
  if prime[i] == i:
    for j in range(i**2, max_num, i):
      if prime[j] == j:
        prime[j] = i
def gcd(a, b): # a >= b
  if a%b == 0:
    return b
  else:
    return gcd(b, a%b)

flg_pairwise = True
flg_setwise = False

n = int(input().rstrip())
a_ls = list(map(int, input().rstrip().split(" ")))
gcd_a = 0
primes_a = []
count_prime = [0 for i in range(max_num)]
for a in a_ls:
  gcd_a = gcd(gcd_a, a)
  if gcd_a == 1:
    flg_setwise = True
  tmp_prime = 0
  while a > 1:
    p = prime[a]
    pp = prime[p]
    if p == 0 or pp == 0:
      flg_pairwise = False
      break
    if tmp_prime != p:
      prime[tmp_prime] = 0
      tmp_prime = p
    a = a//p
  if flg_pairwise:
    prime[tmp_prime] = 0
  if flg_setwise and not flg_pairwise:
    break
if flg_pairwise:
  print("pairwise coprime")
elif flg_setwise:
  print("setwise coprime")
else:
  print("not coprime")

from math import gcd
n,*a = map(int,open(0).read().split())
g = 0
for i in a:
  g = gcd(g,i)
  if g == 1:
    break
else:
  print("not coprime")
  return
m = 10**6+1
d = [i for i in range(m)]
for i in range(4,m,2):
  d[i] = 2
p = 3
while p**2<m:
  if d[p] == p:
    for i in range(3*p,m,2*p):
      if d[i] == i:
        d[i] = p
  p+=2
p = set()
for i in a:
  t = set()
  while i > 1:
    t.add(d[i])
    i //= d[i]
  if p & t:
    print("setwise coprime")
    return
  else:
    p |= t
print('pairwise coprime')

import math

N = int(input())
A = list(map(int, input().split()))
D = [i for i in range(10**6+1)]
a_gcd = 0
for a in A:
  a_gcd = math.gcd(a, a_gcd)
if a_gcd > 1:
  print('not coprime')
  return

for i in range(2, 10**3+1):
  if D[i] == i:
    for n in range(i, 10**6+1, i):
      if D[n] == n:
        D[n] = i

p_set = set()
for a in A:
  d_set = set()
  while a > 1:
    if not D[a] in d_set:
      if D[a] in p_set:
        print('setwise coprime')
        return
      p_set.add(D[a])
      d_set.add(D[a])
    a //= D[a]
print('pairwise coprime')


import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

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

D = getD(max(A))
pairwise_coprime = True
use_divnum = set()
for k in A:
    while k != 1:
        div = D[k]
        if div in use_divnum:
            pairwise_coprime = False
            break
        else:
            use_divnum.add(div)
        
        while k % div == 0 and k > 1:
            k = k // div

if pairwise_coprime:
    print('pairwise coprime')
    return

if reduce(math.gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')




#素因数分解（10**6まで）
def soinsu_bunkai(m):
    pf=set()
    mm =m
    pri_num =[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009]
    for i in pri_num:
        if i > mm:
            break
        while mm %i==0:
            pf.add(i)
            mm //=i
    if mm !=1:
        pf.add(mm)
    return pf

# 初期入力
import math
import sys
from functools import reduce
input = sys.stdin.readline  #文字列では使わない
N = int(input())
A = list(map(int, input().split()))
used =set()
pair_w =set()

# 10**6までの素因数分解するために、「10**6のルート」までの素数を列挙
pri =10**6 +10

#not coprimeの判定
gcd_a =reduce(math.gcd,A)
if gcd_a !=1:
    ans ="not coprime"

#pairwise coprimeの判定
else:
    ans ="pairwise coprime"
    for a in A:
        aa =soinsu_bunkai(a)
        if used & aa:
            print("setwise coprime")
            return #共通要素があったらpair_wではない→set_w
        used |=aa

        
print(ans)

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


# number_to_prime[i]: i の最小の素因数, iが素数ならば0
number_to_prime = [0] * (10**6 + 1)

# preprocess
for i in range(2, 10**6+1):
    if not number_to_prime[i]:
        j = 1
        while j*i <= 10**6:
            number_to_prime[j*i] = i
            j += 1

def is_pairwise():
    used_primes = [False] * (10**6 + 1)
    pairwise_flag = 1
    for a in A:
        curr_primes = set()
        while a > 1:
            prime = number_to_prime[a]
            while a % prime == 0:
                a //= prime
            if used_primes[prime]:
                return False
            used_primes[prime] = 1
    return True

def is_setwise(*A):
    import math
    from functools import reduce

    return reduce(math.gcd, A) == 1

if is_pairwise():
    print("pairwise coprime")
elif is_setwise(*A):
    print("setwise coprime")
else:
    print("not coprime")

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

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

c = [0]*(10**6 + 3)
for i in a:
    c[i] += 1

pairwise = True
for i in range(2,10**6+1):
    if sum(c[::i])>1:
        pairwise = False

g = 0
for i in a:
    g = gcd(g,i)
if g == 1:
    setwise = True
else:
    setwise = False

if pairwise == True:
    print("pairwise coprime")
    return
if setwise == True:
    print("setwise coprime")
    return
print("not coprime")

from math import gcd
from functools import reduce
N=int(input())
A=list(map(int,input().split()))

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

l=primes(max(A))
#print(l)
d=[0]*max(A)
for i in A:
  d[i-1]=1
#print(d)
#for i in l:
#  print(d[i-1::i])
if reduce(gcd,A)==1:
#   print('setwise coprime')
  if all(sum(d[i-1::i])<=1 for i in l):
    print('pairwise coprime')
  else:print('setwise coprime')
else:
   print('not coprime')

import sys
def input(): return sys.stdin.readline().rstrip()
class Sieve: #区間[2,n]の値の素因数分解 O(nloglogn+logn)
    def __init__(self,n): #nは計算対象としてありうる最大の値
        self.primes=[]
        self.f=[0]*(n+1) #ふるい（素数ならその値）
        self.f[0]=self.f[1]=-1
        self.f_lis = [0]*(n+1)
        for i in range(2,n+1): #素数リスト作成
            if self.f[i]: continue
            self.primes.append(i)
            self.f[i]=i
            for j in range(i*i,n+1,i):
                if not self.f[j]:
                    self.f[j]=i  #最小の素因数を代入
    def prime_fact(self,A): #素因数分解 {2:p,3:q,5:r,...}
        for x in A:
            while x!=1:
                p=self.f[x]
                x//=p
                if x % p > 0:
                    if self.f_lis[p] > 0: return False
                    self.f_lis[p] += 1
        return True

import math
from functools import reduce
def gcd_all(numbers):#gcd(A)
    return reduce(math.gcd, numbers)

def main():
    n = int(input())
    A = list(map(int,input().split())) 
    Sieve_a = Sieve(max(A)+1)
    if Sieve_a.prime_fact(A):
        print("pairwise coprime")
    elif gcd_all(A) == 1:
        
        print("setwise coprime")   
    else:
        print("not coprime")

def __starting_point():
    main()
__starting_point()

from math import gcd

N = int(input())
A = list([int(x) for x in input().split()])

max_a = max(A)

before = 0
result = [0 for _ in range(max_a + 1)]

for i in A:
    before = gcd(before, i)
    result[i] += 1

is_pairwise = True

for i in range(2, max_a + 1):
    cnt = 0
    for j in range(i, max_a + 1, i):
        cnt += result[j]
    if cnt > 1:
        is_pairwise = False
        break

if is_pairwise:
    print('pairwise coprime')
    return
if before == 1:
    print('setwise coprime')
else:
    print('not coprime')


# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 07:10:00 2020

@author: liang
"""


# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 00:26:07 2020

@author: liang
"""

"""
コーナーケース１:
    重複があるとき　not coprime
    ただし、1の重複は除く
"""
import math
C = 10**6
N = int(input())
judge = [False]*(C+1)
A = [int(x) for x in input().split()]

f = True
for a in A:
    if judge[a] == True and a != 1:
        f = False
    judge[int(a)]=True


#print(judge[:10])
def solve(f):
    
    ans = A[0]
    #線形探索 O(N)
    for i in range(N):
        ans = math.gcd(ans,A[i])
    #print("ans",a)
    if ans != 1:
        return "not coprime"
    
    flag = True
    #エラトステネスの篩 O(N log N)
    for i in range(2,C+1):
        count = 0
       #if d[i] == True:
        for j in range(i,C+1,i):
            if judge[j] == True:
                count += 1
            if count == 2:
                flag = False
                break
        #        d[j] = False
        if not flag:
            break
    
    if flag == True and f == True:
        return "pairwise coprime"
    
    return "setwise coprime"

print((solve(f)))
#print(len(A))


from math import gcd
flag=0
N=int(input())
A=list(map(int,input().split()))
Max=max(A)
a=[0]*(Max+1)
for i in A:
    a[i]+=1
for i in range(2,Max+1):
    if sum(a[i::i])>=2:
        flag=1
        break
if flag==0:
    print('pairwise coprime')
else:
    r=A[0]
    for i in A:
        r=gcd(r,i)
    if r==1:
        print('setwise coprime')
    else:
        print("not coprime")

from math import gcd, sqrt
from functools import reduce

n, *A = map(int, open(0).read().split())
def f(A):
    sup = max(A)+1
    table = [i for i in range(sup)]
    for i in range(2, int(sqrt(sup))+1):
        if table[i] == i:
            for j in range(i**2, sup, i):
                table[j] = i

    D = set()
    for a in A:
        while a != 1:
            if a not in D:
                D.add(a)
                a //= table[a]
            else:
                return False
    return True

if reduce(gcd, A) == 1:
    if f(A):
        print('pairwise coprime')
    else:
        print('setwise coprime')
else:
    print('not coprime')

from math import gcd

def make_kazu_list(n):
    l = [0]*n
    l[1] = 1
    i = 2
    while i < n:
        if l[i] == 0:
            j = i
            while j < n:
                l[j] = i if l[j] == 0 else l[j]
                j += i
        i += 1
    return l

def soinsuubunkai(n, l):
    r = []
    if n < 2:
        return r
    while l[n] != n:
        r.append(l[n])
        n = n // l[n]
    r.append(l[n])
    return set(r)

# l = make_kazu_list(101)
# print(soinsuubunkai(2, l))
# print(soinsuubunkai(66, l))
# print(soinsuubunkai(72, l))

def f(n, ais):
    pl = [False]*1000001
    l = make_kazu_list(1000001)
    for n in soinsuubunkai(ais[0], l):
        pl[n] = True
    common_factors = ais[0]
    pairwise_coprime = True
    setwise_coprime = False
    for ai in ais[1:]:
        if not pairwise_coprime and setwise_coprime:
            break
        if pairwise_coprime:
            numbers = soinsuubunkai(ai, l)
            for n in numbers:
                if pl[n]:
                    pairwise_coprime = False
                    break
                else:
                    pl[n] = True
        if not setwise_coprime:
            common_factors = gcd(common_factors, ai)
            if common_factors == 1:
                setwise_coprime = True
    if pairwise_coprime:
        return 'pairwise coprime'
    elif setwise_coprime:
        return 'setwise coprime'
    else:
        return 'not coprime'

n = int(input())
ais = list(map(int, input().split(' ')))
print((f(n, ais)))


#E_Coprime
import math
import functools

# エラトステネスの篩
        
def primes(n):
    is_prime = [1] * (n + 1)
    is_prime[0] = 0
    is_prime[1] = 0
    D_prime = [i for i in range(n+1)] 
    D_prime[0] = 0
    D_prime[1] = 1
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            D_prime[i] = i
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = 0
            D_prime[j] = i
    return D_prime

    

Fnum_list2 = []
# 入力
N = int(input())
A = list(map(int,input().split()))

#Fnum_list = eratosthenes(N)

A.sort()
Amax = A[-1]
Fnum_list2 = primes(Amax)
j = A[0]
ans = 1
#Fnum_list = eratosthenes(N)
Ai_primes     = set()
Ai_primes_add = []
gcd_num = 0
for i in range(len(A) ):
    p = A[i]
    while p != 1:
        j = p
        p = int (p / Fnum_list2[j])
        if Fnum_list2[j] in Ai_primes:
            ans = 0
        else:
            Ai_primes_add.append(Fnum_list2[j])
    if Fnum_list2[j] in Ai_primes:
        break
    else:
        Ai_primes |= set(Ai_primes_add)
        Ai_primes_add.clear()

gcd_num = functools.reduce(math.gcd,A)

if ans == 0:
    if gcd_num == 1:
        ans = 2

# 出力
if ans == 1:
    print("pairwise coprime")
else:
    if ans == 2:
        print("setwise coprime")
    else:
        print("not coprime")


from math import gcd

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

def osa_k(max_num):
  lis = [i for i in range(max_num+1)]
  p = 2
  while p**2 <= max_num:
    if lis[p] == p:
      for q in range(2*p, max_num+1, p):
        if lis[q] == q:
          lis[q] = p
    p += 1
  return lis

hoge = 0
for i in num_lis:
  hoge = gcd(hoge, i)
if hoge > 1:
  print("not coprime")
  return

d_lis = osa_k(max(num_lis))
tmp = set()
for i in num_lis:
  num = i
  new_tmp = set()
  while num > 1:
    d = d_lis[num]
    new_tmp.add(d)
    num //= d
  for j in new_tmp:
    if j in tmp:
      print("setwise coprime")
      return
    else:
      tmp.add(j)
print("pairwise coprime")

from functools import reduce
from math import gcd

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

c=max(A)+1
D=[0]*c
div=[0]*c
P=[]

for i in range(2,c):
    if D[i]==0:
        P.append(i)
        D[i]=i
    for j in P:
        if i*j>=c  or j>D[i] :
           break
        D[i*j]=j
f=0
for i in A:
    if i==1:
        continue
    temp=i
    while temp!=1:
        if div[D[temp]]==1:
            f=1
            break
        div[D[temp]]+=1
        temp2=D[temp]
        while temp%temp2==0 and temp>=temp2:
            temp=temp//temp2
    if f==1:
        break
        


if max(div)<=1 and f==0:
    print('pairwise coprime')

elif reduce(gcd, A) == 1:
    print('setwise coprime')

else:
    print('not coprime')

n=int(input())
A=[int(x) for x in input().split()]

u=10**6+1
C=[0]*u
D=[0]*2+[1]*(u-2)

def e():
  n=4
  while n<u:
    D[n]=0
    n+=2
  i=3
  while i*i<u:
    if D[i]:
      n=i*2
      while n<u:
        D[n]=0
        n+=i
    i+=2

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

for a in A:
  C[a]+=1
e()
for i in [x for x in range(2,u) if D[x]==1]:
  if sum(C[i::i])>1:
    break
else:
  print('pairwise coprime')
  return

c=A[0]
for a in A:
  c=gcd(c,a)
  if c==1:
    break
else:
  print('not coprime')
  return

print('setwise coprime')


import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

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

D = getD(max(A))

flag = True

d_set = set()
for k in A:
    while k != 1:
        div = D[k]
        if div in d_set:
            flag = False
            break
        else:
            d_set.add(div)
        
        while k % div == 0 and k > 1:
            k = k // div

if flag:
    print('pairwise coprime')
    return

if reduce(math.gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


import math
import sys
input = sys.stdin.readline
pc = True
n = int(input())
a = list(map(int,input().split()))
g = math.gcd(a[0],a[1])
for i in range(2,n):
    g = math.gcd(g,a[i])
M = max(a)
class Sieve_of_Eratosthenes:
    def __init__(self, N):
        self.sieve = [-1] * (N+1)

        for i in range(2,N+1):
            if self.sieve[i] == -1:
                for j in range(1,1+N//i):
                    self.sieve[i*j] = i

    def isprime(self, num):
        if num <= 1:
            return False
        else:
            return self.sieve[num] == num

    def factorization(self, num):
        ret = set([])
        while num != 1:
            div = self.sieve[num]
            ret.add(div)
            num //= div
        return ret

sofe = Sieve_of_Eratosthenes(M)

judge = set([])

for i in a:
    if not pc:
        break
    asf = sofe.factorization(i)
    
    if judge & asf != set():
        pc = False
    judge |= asf
if pc:
    print("pairwise coprime")
elif g == 1:
    print("setwise coprime")
else:
    print("not coprime")


import math

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

g = 0
for a in A:
    g = math.gcd(g, a)
if g != 1:
    print('not coprime')
    return

is_prime = [1] * 1000001
D = [0] * 1000001

for i in range(2, 1001):
    if is_prime[i]:
        D[i] = i
        j = 2 * i
        while j <= 1000000:
            if is_prime[j]:
                D[j] = i
                is_prime[j] = 0
            j += i
for i in range(1001, 1000001):
    if is_prime[i]:
        D[i] = i

count = [0] * 1000001
for a in A:
    k = a
    pre = 0
    while k != 1:
        if pre != D[k]:
            count[D[k]] += 1
            if count[D[k]] == 2:
                print('setwise coprime')
                return
        pre = D[k]
        k = int(k / D[k])
print('pairwise coprime')


from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce, lru_cache
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

n = INT()
a = LIST()

c = [0]*(10**6+1)
for x in a:
    c[x] += 1

k = max(sum(c[i::i]) for i in range(2, 10**6+1))

if k <= 1:
    print("pairwise coprime")
elif k < n:
    print("setwise coprime")
else:
    print("not coprime")

from math import gcd


def main():
    N = int(input())
    A = list([int(x) for x in input().split()])

    max_a = max(A)

    before = 0
    result = [0 for _ in range(max_a + 1)]

    for i in A:
        before = gcd(before, i)
        result[i] += 1

    is_pairwise = True
    for i in range(2, max_a + 1):
        cnt = 0
        for j in range(i, max_a + 1, i):
            cnt += result[j]

        if cnt > 1:
            is_pairwise = False
            break

    if is_pairwise:
        print('pairwise coprime')
        return

    if before == 1:
        print('setwise coprime')
    else:
        print('not coprime')


def __starting_point():
    main()

__starting_point()

import numpy as np
N=int(input())
A=list(map(int,input().split()))
cnt=[0]*(10**6+1)
for a in A:cnt[a]+=1
 
if np.gcd.reduce(A)!=1:
  print("not coprime")
elif np.all([sum(cnt[i::i])<=1 for i in range(2,10**6+1)]):
  print("pairwise coprime")
else:
  print("setwise coprime")

import math

def eratosthenes():
    erat = [0 for _ in range(max_a+1)]
    #lim = int(math.sqrt(max_a))
    pair = True
    #for i in range(2, lim+1):
    for i in range(2, max_a+1):
        cnt = 0
        if not erat[i]:
            for res in range(i, max_a+1, i):
                if res in set_a:
                    cnt += 1
                erat[res] = i
                if cnt > 1:
                    pair = False
                    break
        if not pair:
            break
    return pair


n = int(input())
a = [int(x) for x in input().split()]
max_a = max(a)
set_a = set(a)

if eratosthenes() and len(set_a) == n - max(0, a.count(1)-1):
    print('pairwise coprime')
else:
    res = a[0]
    for i in range(n):
        res = math.gcd(res, a[i])
    if res == 1:
        print('setwise coprime')
    else:
        print('not coprime')


from math import gcd

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

checker = [0 for _i in range(10**6+1)]
for i in a:
    checker[i] += 1

if all(sum(checker[i::i])<2 for i in range(2,10**6+1)):
    print('pairwise coprime')
else:
    r = a[0]
    for i in a:
        r = gcd(r, i)
    if r == 1:
        print('setwise coprime')
    else:
        print('not coprime')

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

def gcd_all(a):
    n = len(a)
    gcd = a[0]
    for i in range(1, n):
        gcd = GCD(gcd, a[i])
    return gcd

def f(a):
    mx = 10**6
    p = set([])
    sieve = [i for i in range(mx + 1)]
    for i in range(2, int(mx**0.5 + 1)):
        for j in range(2 * i, mx + 1, i):
            if sieve[j] > i:
                sieve[j] = i
    pairwise_coprime = True
    for i in a:
        p2 = set([])
        while i > 1:
            p2.add(sieve[i])
            i //= sieve[i]
        for j in p2:
            if j in p:
                pairwise_coprime = False
                break
            p.add(j)
        if pairwise_coprime == False:
            break
    gcd = gcd_all(a)
    if pairwise_coprime == False and gcd == 1:
        return 'setwise coprime'
    elif pairwise_coprime:
        return 'pairwise coprime'
    else:
        return 'not coprime'

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


import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

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

D = getD(max(A))

flag = True

d_set = set()
for a in A:
    while a != 1:
        d = D[a]
        if d in d_set:
            flag = False
            break
        else:
            d_set.add(d)
        while a > 1 and a % d == 0:
            a = a // d
    if not(flag):
        break



if flag:
    print('pairwise coprime')
    return

if reduce(math.gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


def divplis(N):
    lis = [i for i in range(N+1)]
    for i in range(int(N**0.5+1),1,-1):
        if lis[i] == i:
            lis[i::i] = [i]*(N//i)
    return lis

divp = divplis(10**6+1)
N = int(input())
d = [0]*(10**6+1)
A = [int(i) for i in input().split()]


def pfact(N):
    b = 0
    while N != 1:
        n = divp[N]
        if b != n:
            d[n] += 1
        b = n
        N = N // n
    return 0
    
for a in A:
    pfact(a)
m = max(d)
if m <= 1:
    print("pairwise coprime")
elif m == N:
    print("not coprime")
else:
    print("setwise coprime")


N=int(input())
from math import gcd
from functools import reduce
l=list(map(int,input().split()))
sw=0
c=[0]*1000001
for i in l:
   c[i]+=1
if all(sum(c[i::i])<=1 for i in range(2,1000001)):
  print("pairwise coprime")
elif reduce(gcd,l)==1:
   print("setwise coprime")
else:
   print("not coprime")

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

maxn =  1000005
prime = [0 for _ in range(maxn)]

for i in range(2, maxn):
    if prime[i] == 0:
        for j in range(i, maxn, i):
            prime[j] = i #最大質因數

st = set() #目前出現過的所有質因數，一開始為A[0]的所有質因數
a = A[0]
while prime[a]:
    st.add(prime[a])
    x = prime[a]
    while (a % x == 0):
        a //= x

pairwise = True
st2 = st #所有數共有的質因數，一開始為A[0]的所有質因數
for a in A[1:]:
    tmp = set()
    for j in st2:
        if a % j == 0:
            tmp.add(j)

    st2 = tmp
    if pairwise:
        while prime[a]:
            if prime[a] in st:
                pairwise = False
            st.add(prime[a])
            x = prime[a]
            while (a % x == 0):
                a //= x

if pairwise:
    print("pairwise coprime")
elif len(st2) == 0:
    print("setwise coprime")
else:
    print("not coprime")

n=int(input())
A=[int(x) for x in input().split()]

u=10**6+1
C=[0]*u
D=[0]*2+[1]*(u-2)

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

n=4
while n<u:
  D[n]=0
  n+=2
i=3
while i*i<u:
  if D[i]:
    n=i*2
    while n<u:
      D[n]=0
      n+=i
  i+=2

for a in A:
  C[a]+=1
for i in [x for x in range(2,u) if D[x]==1]:
  if sum(C[i::i])>1:
    break
else:
  print('pairwise coprime')
  return

c=A[0]
for a in A:
  c=gcd(c,a)
  if c==1:
    break
else:
  print('not coprime')
  return

print('setwise coprime')


from math import gcd
from functools import reduce
N=int(input())
A=list(map(int,input().split()))

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

l=primes(max(A))
#print(l)
d=[0]*max(A)
for i in A:
  d[i-1]=1
#print(d)
#for i in l:
#  print(d[i-1::i])
if reduce(gcd,A)>1:
  print('not coprime')
elif all(sum(d[i-1::i])<=1 for i in l):
    print('pairwise coprime')
else:print('setwise coprime')

from math import gcd
from functools import reduce

N, *A = list(map(int, open(0).read().split()))

def f():
    t = [0] * (10 ** 6 + 1)
    for a in A:
        t[a] += 1

    c = 0
    for j in range(2, 10 ** 6 + 1, 2):
        c += t[j]
    if c > 1:
        return False

    for i in range(3, 10 ** 6 + 1, 2):
        c = 0
        for j in range(i, 10 ** 6 + 1, i):
            c += t[j]
        if c > 1:
            return False

    return True

if f():
    print('pairwise coprime')
elif reduce(gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


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

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

g = 0

A.sort()

for item in A:
    g = gcc(g, item)

if g != 1:
    print("not coprime")
    return

primes = []
is_prime = [True] * 1100000

is_prime[0] = is_prime[1] = False

for i in range(2, 1100000):
    if not is_prime[i]:continue
    for j in range(i*i, 1100000, i):
        is_prime[j] = False
    primes.append(i)

A_prime = [item for item in A if is_prime[item]]
A_notprime = [item for item in A if not is_prime[item]]

used = [False] * 1100000

for item in A_prime:
    used[item] = True

for a in A_notprime:
    for p in primes:
        if a == 1:break
        if a % p != 0:continue

        if used[p]:
            print("setwise coprime")
            #互いに素でない（共通素因数pで割れる）ペアがAの中にあると，それはsetwise_coprime
            return

        used[p] = True

        while a % p == 0:
            a //= p

print("pairwise coprime")

import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

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

D = getD(max(A))
pairwise_coprime = True
use_divnum = set()
for i in range(N):
    k = A[i]
    while k != 1:
        if D[k] in use_divnum:
            pairwise_coprime = False
            break
        else:
            use_divnum.add(D[k])
        div = D[k]
        while k % div == 0 and k > 1:
            k = k // div

if pairwise_coprime:
    print('pairwise coprime')
    return

if reduce(math.gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


import math
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
ans=reduce(math.gcd,a)
if ans>1:
  print("not coprime")
  return
maxn=10**6+10
li=[i for i in range(maxn+1)]
p=2
while p*p<=maxn:
  if li[p]==p:
    for q in range(2*p,maxn,p):
      if li[q]==q:
        li[q]=p
  p+=1
ans=[0]*(maxn+1)
for i in a:
  bk=0
  while i>1:
    wk=li[i]
    i//=wk
    if ans[wk]==0 and bk!=wk:
      ans[wk]=1
      bk=wk
    elif bk==wk:
      continue
    else:
      print("setwise coprime")
      return
print("pairwise coprime")

from math import gcd
from functools import reduce

N, *A = list(map(int, open(0).read().split()))

def f():
    t = [0] * (10 ** 6 + 1)
    for a in A:
        t[a] += 1

    c = 0
    for j in range(2, 10 ** 6 + 1, 2):
        c += t[j]
    if c > 1:
        return False

    for i in range(3, 10 ** 6 + 1, 2):
        c = 0
        for j in range(i, 10 ** 6 + 1, i):
            c += t[j]
        if c > 1:
            return False

    return True

if f():
    print('pairwise coprime')
elif reduce(gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

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

D = getD(max(A))

flag = True

d_set = set()
for a in A:
    while a != 1:
        d = D[a]
        if d in d_set:
            flag = False
            break
        else:
            d_set.add(d)
        
        while a % d == 0 and a > 1:
            a = a // d

if flag:
    print('pairwise coprime')
    return

if reduce(math.gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


from math import gcd

N = int(input())
num_lis = list(map(int, input().split()))
c1 = True
c2 = True

def osa_k(max_num):
  lis = [i for i in range(max_num+1)]
  p = 2
  while p**2 <= max_num:
    if lis[p] == p:
      for q in range(2*p, max_num+1, p):
        if lis[q] == q:
          lis[q] = p
    p += 1
  return lis

hoge = 0
for i in num_lis:
  hoge = gcd(hoge, i)
if hoge > 1:
  c1 = False

if c1:
  d_lis = osa_k(max(num_lis))
  tmp = set()
  for i in num_lis:
    num = i
    new_tmp = set()
    while num > 1:
      d = d_lis[num]
      new_tmp.add(d)
      num //= d
    for j in new_tmp:
      if j in tmp:
        c2 = False
        break
      else:
        tmp.add(j)
    else:
      continue
    break
else:
  c2 = False

if c2:
  print("pairwise coprime")
elif c1:
  print("setwise coprime")
else:
  print("not coprime")

from math import gcd
class Factor:
    def __init__(self, max_element):
        self.minFactor = [-1]*(max_element+1)
        for i in range(2, max_element+1):
            if self.minFactor[i] == -1:
                for j in range(i, max_element+1, i):
                    self.minFactor[j] = i
    def getFactorSet(self, element):
        retSet = set(1)
        while element > 1:
            retSet.add(element)
            retSet.add(self.minFactor[element])
            element //= self.minFactor[element]
        return retSet
    def getPrimeFactorSet(self, element):
        retSet = set()
        while element > 1:
            retSet.add(self.minFactor[element])
            element //= self.minFactor[element]
        return retSet
    def getPrimeFactorDic(self, element):
        retDic = {}
        while element > 1:
            val = self.minFactor[element]
            if val in retDic:
                retDic[val] += 1
            else:
                retDic[val] = 1
            element //= val
        return retDic

def main():
    n = int(input())
    a = list(map(int, input().split()))
    f = True
    fact = Factor(max(a))
    st = set()
    for v in a:
        fac_set = fact.getPrimeFactorSet(v)
        for u in fac_set:
            if u in st:
                f = False
                break
            st.add(u)
        if not f:
            break
    if f:
        print("pairwise coprime")
    else:
        all_gcd = a[0]
        for i in range(1, n):
            all_gcd = gcd(all_gcd, a[i])
        if all_gcd == 1:
            print("setwise coprime")
        else:
            print("not coprime")

def __starting_point():
    main()
__starting_point()

#!/usr/bin/env python
from math import sqrt
from collections import Counter

def gen_primes(X):
    D = [0] * (X+1)
    is_prime = [True for _ in range(0, X+1)]
    is_prime[0] = False
    is_prime[1] = False
    primes = []
    for n in range(2, int(sqrt(X))+1):
        if is_prime[n]:
            primes.append(n)
            j = n*2
            D[n] = n
            while j <= X:
                is_prime[j] = False
                if D[j] == 0:
                    D[j] = n
                j += n
    for n in range(int(sqrt(X)), X+1):
        if is_prime[n]:
            D[n] = n
            primes.append(n)
    return primes, D


def solve(A):
    N = len(A)
    primes, D = gen_primes(10**6)
    C = [0] * (primes[-1]+1)

    for a in A:
        a_ = a
        while a > 1:
            d = D[a]
            while a % d == 0:
                a //= d
            C[d] += 1
        
    M = max(C)
    if M <= 1:
        print("pairwise coprime")
    elif M != N:
        print("setwise coprime")
    else:
        print("not coprime")

#solve([x for x in range(1, 10**6+1)])
N = int(input())
A = [int(x) for x in input().split()]
solve(A)


"""E."""

import sys


def input() -> str:  # noqa: A001
    """Input."""
    return sys.stdin.readline()[:-1]


RESULT_TEXT = {
    1: 'pairwise coprime',
    2: 'setwise coprime',
    3: 'not coprime',
}

n = int(input())

a_list = list(map(int, input().split(' ')))

ans = 0

MAX = 1000000 + 1
counts = [0] * MAX
for a in a_list:
    counts[a] += 1

max_count = 0

for i in range(2, MAX):
    max_count = max(max_count, sum(counts[i::i]))

if max_count == n:
    ans = 3
elif max_count >= 2:
    ans = 2
else:
    ans = 1

print((RESULT_TEXT[ans]))


from math import gcd
n=int(input())
l=list(map(int,input().split()))
mal=max(l)
e=[i for i in range(mal+1)]

x=2
while x*x <= mal:
    if x == e[x]:
        for m in range(x, len(e), x):
            if e[m] == m:
                e[m] = x
    x+=1
#print(e)    
s=set()
f=0
for i in l:
  st = set()
  while i > 1:
    st.add(e[i])
    i//=e[i]
  if not s.isdisjoint(st):
    f=1
    break
  s |= st

if f==0:
    print('pairwise coprime')
    return
p=l[0]
for i in range(1,n):
    p=gcd(p,l[i])
if p==1:
    print('setwise coprime')
else:
    print('not coprime')


def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    N = int(input())
    A = [int(x) for x in input().strip().split()]
    maxA = max(A)
    if maxA == 1:
        print('pairwise coprime')
        return
    prime = [i if i % 2 != 0 else 2 for i in range(maxA+1)]
    f = [False] * (maxA+1)
    for i in range(3, int(maxA**.5)+1):
        if prime[i] != i:
            continue
        p = i * 2
        while p <= maxA:
            if prime[p] == p:
                prime[p] = i
            p += i

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

    setwise_coprime = A[0]
    for An in A[1:]:
        setwise_coprime = gcd(setwise_coprime, An)
        if setwise_coprime == 1:
            break
    # print(prime)
    for An in A:
        if An == 1:
            continue
        # print('An = {}'.format(An))
        not_pairwise_coprime = False
        while prime[An] != An:
            # print('prime[An]={}, f[prime[An]]={}'.format(prime[An], f[prime[An]]))
            if f[prime[An]]:
                not_pairwise_coprime = True
                break
            f[prime[An]] = True
            prime_An = prime[An]
            while An % prime_An == 0:
                An //= prime_An
        else:
            if An != 1:
                if f[An]:
                    not_pairwise_coprime = True
                else:
                    f[An] = True
        if not_pairwise_coprime:
            break
        # print(f)
    else:
        print('pairwise coprime')
        return
    if setwise_coprime == 1:
        print('setwise coprime')
    else:
        print('not coprime')

def __starting_point():
    main()
__starting_point()

from math import gcd

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

# 解説AC(a*loga)
ans = 0
cnt = [0] * (max(a) + 1)
for ai in a:
    ans = gcd(ans, ai)
    cnt[ai] += 1

if ans != 1:
    print('not coprime')
elif any(sum(cnt[i::i]) > 1 for i in range(2, max(a) + 1)):
    print('setwise coprime')
else:
    print('pairwise coprime')


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

num = [0]*(10**6+1)

for x in a:
    num[x] += 1

f = 1
for i in range(2, 10**6+1):
    s = sum(num[i::i])
    if s == n:
        print("not coprime")
        return
    if s > 1 :
        f = 0
if f == 0:
    print("setwise coprime")
else:
    print("pairwise coprime")