AtCoder Beginner Contest 177 - Coprime

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.

Source: atcoder | Difficulty: MEDIUM_HARD


Solutions:
def main():
	from math import gcd
	(n, *a) = map(int, open(0).read().split())
	m = max(a)
	c = [0] * (m + 1)
	g = a[0]
	for i in a:
		g = gcd(g, i)
		c[i] = 1
	if g > 1:
		pre = 'not'
	else:
		for i in range(2, 10 ** 6 + 1):
			if sum(c[i::i]) > 1:
				pre = 'setwise'
				break
		else:
			pre = 'pairwise'
	print(pre + ' coprime')
main()


import math
N = 1000001
spf = [*range(N)]
i = 2
while i * i < N:
	if spf[i] == i:
		for j in range(i * i, N, i):
			if spf[j] == j:
				spf[j] = i
	i += 1
r = 'pairwise'
input()
d = None
u = set()
for x in map(int, input().split()):
	d = math.gcd(d or x, x)
	s = set()
	while x > 1:
		p = spf[x]
		if p in u:
			r = 'setwise'
		s.add(p)
		x //= p
	u |= s
print(d > 1 and 'not' or r, 'coprime')


from math import gcd
n = int(input())
s = list(map(int, input().split()))
s.sort()
dp = [0] * (10 ** 6 + 100)
res = s[0]
for ss in s:
	dp[ss] += 1
	res = gcd(res, ss)
A = max(s)
pairwise = True
for i in range(2, A + 1):
	cnt = 0
	for j in range(i, A + 1, i):
		cnt += dp[j]
	if cnt > 1:
		pairwise = False
if pairwise:
	print('pairwise coprime')
elif res == 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

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)

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))


import math
N = int(input())
A = list(map(int, input().split()))
m = [0] * int(1000000.0 + 1)
for i in range(N):
	m[A[i]] += 1
pw = True
for p in range(2, len(m)):
	c = 0
	for i in range(p, len(m), p):
		c += m[i]
	if c > 1:
		pw = False
		break
if pw:
	print('pairwise coprime')
	exit()
d = A[0]
for i in range(N):
	d = math.gcd(d, A[i])
if d == 1:
	print('setwise coprime')
else:
	print('not coprime')


from math import gcd
n = int(input())
a = [int(i) for i in input().split()]
g = a[0]
for i in range(n):
	g = gcd(g, a[i])
if g != 1:
	print('not coprime')
	exit()
s = set(a)
a.sort()
m = a[-1]
isPrime = [False] * (m + 1)
for i in range(2, m + 1):
	if isPrime[i]:
		continue
	flag = False
	for j in range(i, m + 1, i):
		isPrime[j] = True
		if j in s:
			if flag:
				print('setwise coprime')
				exit()
			flag = True
print('pairwise coprime')


M = 10 ** 6 + 1
f = lambda p: exit(print(['pairwise', 'setwise', 'not'][p] + ' coprime'))
(n, *l) = map(int, open(0).read().split())
from math import *
(g, C) = (0, [0] * M)
for x in l:
	g = gcd(g, x)
	C[x] = 1
if g > 1:
	f(2)
if any((sum(C[i::i]) > 1 for i in range(2, M))):
	f(1)
f(0)


(_, *A) = map(int, open(0).read().split())
lc = 10 ** 6 + 1
C = [0] * lc
for a in A:
	C[a] += 1
import functools, math
t = any((sum(C[i::i]) > 1 for i in range(2, lc)))
t += functools.reduce(math.gcd, A) > 1
print(['pairwise', 'setwise', 'not'][t], 'coprime')


import sys, math
n = int(input())
a = list(map(int, input().split()))
numbers = {}
flag = 0
for i in range(n):
	if a[i] in numbers:
		numbers[a[i]] += 1
	else:
		numbers[a[i]] = 1
for pointer in range(2, 10 ** 6 + 1):
	count = 0
	pointer2 = pointer
	while pointer2 < 10 ** 6 + 1:
		if pointer2 in numbers:
			count += numbers[pointer2]
		pointer2 += pointer
	if count >= 2:
		flag = 1
		break
if flag == 0:
	print('pairwise coprime')
	sys.exit()
ans = a[0]
for i in range(1, n):
	ans = math.gcd(a[i], ans)
if ans == 1:
	print('setwise coprime')
else:
	print('not coprime')


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

def solve(f):
	ans = A[0]
	for i in range(N):
		ans = math.gcd(ans, A[i])
	if ans != 1:
		return 'not coprime'
	flag = True
	for i in range(2, C + 1):
		count = 0
		for j in range(i, C + 1, i):
			if judge[j] == True:
				count += 1
			if count == 2:
				flag = False
				break
		if not flag:
			break
	if flag == True and f == True:
		return 'pairwise coprime'
	return 'setwise coprime'
print(solve(f))


import sys, 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')
	exit(0)
M = 10 ** 6 + 5
B = dict()
for a in A:
	if a in B:
		B[a] = B[a] + 1
	else:
		B[a] = 1
for i in range(2, M):
	cnt = 0
	for j in range(i, M, i):
		if j in B:
			cnt += B[j]
	if cnt > 1:
		print('setwise coprime')
		exit(0)
print('pairwise 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')


import sys
from math import gcd
input = lambda : sys.stdin.readline().rstrip()
n = int(input())
A = list(map(int, input().split()))
nowgcd = A[0]
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
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
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')


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')


def gcd_all(a):
	from math import gcd
	g = 0
	for x in a:
		g = gcd(g, x)
	return g

def is_pairwise():
	MAX_A = 10 ** 6 + 1
	C = [0] * MAX_A
	for a in A:
		C[a] += 1
	if sum(C[2::2]) > 1:
		return False
	for i in range(3, MAX_A, 2):
		if sum(C[i::i]) > 1:
			return False
	return True

def solve():
	if is_pairwise():
		return 'pairwise'
	if gcd_all(A) == 1:
		return 'setwise'
	return 'not'
n = int(input())
A = [*map(int, input().split())]
print(solve(), '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')


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 ** 0.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')


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


from math import gcd
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
d = [0] * 10 ** 6
for i in a:
	d[i - 1] += 1
num = 2
while num <= 10 ** 6:
	if sum([d[i * num - 1] for i in range(1, 10 ** 6 // num + 1)]) > 1:
		break
	num += 1
else:
	print('pairwise coprime')
	exit()
g = reduce(gcd, a)
if g == 1:
	print('setwise coprime')
	exit()
print('not coprime')


def gcd(a, b):
	if a < b:
		return gcd(b, a)
	while b > 0:
		(a, b) = (b, a % b)
	return a
n = int(input())
a_list = list(map(int, input().split()))
checker = [0] * (10 ** 6 + 1)
x = a_list[0]
for a in a_list:
	x = gcd(x, a)
	checker[a] += 1
if all((sum(checker[d::d]) <= 1 for d in range(2, 10 ** 6 + 1))):
	print('pairwise coprime')
elif x == 1:
	print('setwise coprime')
else:
	print('not coprime')


import math
from functools import reduce
n = int(input())
a_list = list(map(int, input().split()))
max = 10 ** 6 + 1
memo = [0] * max
for a in a_list:
	memo[a] += 1
for i in range(2, max):
	if sum(memo[i::i]) > 1:
		if reduce(math.gcd, a_list) == 1:
			print('setwise coprime')
			exit()
		else:
			print('not coprime')
			exit()
print('pairwise coprime')


import math
L = 10 ** 6 + 1
N = int(input())
A = list(map(int, input().split()))
memo = [0] * L
flag = 0
for a in A:
	memo[a] += 1
for i in range(2, L):
	if sum(memo[i::i]) > 1:
		flag = 1
		break
g = 0
for i in range(N):
	g = math.gcd(g, A[i])
if flag == 0:
	answer = 'pairwise coprime'
elif flag == 1 and g == 1:
	answer = 'setwise coprime'
else:
	answer = 'not coprime'
print(answer)


from math import gcd
from functools import reduce

def osa_k(n=10 ** 6):
	p = list(range(n + 1))
	for i in range(2, int(n ** 0.5)):
		if p[i] < i:
			continue
		for j in range(i * i, n + 1, i):
			if p[j] == j:
				p[j] = i
	return p

def fact_o(n):
	a = []
	f = 0
	while n > 1:
		if f != p[n]:
			ans[p[n]] += 1
		f = p[n]
		n //= p[n]
	return 0
p = osa_k()
n = int(input())
a = list(map(int, input().split()))
ans = [0] * (10 ** 6 + 1)
for i in a:
	fact_o(i)
if max(ans) <= 1:
	print('pairwise coprime')
elif reduce(gcd, a) == 1:
	print('setwise coprime')
else:
	print('not coprime')


(n, a) = (int(input()), list(map(int, input().split())))
g = 0
from math import gcd
for i in a:
	g = gcd(i, g)
if g != 1:
	print('not coprime')
else:
	primes = list(range(10 ** 6 + 1))
	primes[0] = primes[1] = 0
	for i in range(2, 10 ** 6 + 1):
		if primes[i] == i:
			for j in range(2 * i, 10 ** 6, i):
				primes[j] = i
	ps = set()
	for x in a:
		while x != 1:
			t = primes[x]
			if t in ps:
				print('setwise coprime')
				exit()
			ps.add(t)
			while x % t == 0:
				x //= t
	print('pairwise coprime')


n = int(input())
a = [int(x) for x in input().split()]
ma = max(a)
memo = [0] * ma

def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a
for i in a:
	memo[i - 1] += 1
pair = True
for i in range(2, ma + 1):
	cnt = 0
	for j in range(i, ma + 1, i):
		if 0 < memo[j - 1]:
			cnt += 1
	if 1 < cnt:
		pair = False
g = a[0]
for i in range(1, n):
	g = gcd(g, a[i])
if pair == False and g == 1:
	print('setwise coprime')
elif pair == True and g == 1:
	print('pairwise 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')


n = int(input())
l = [*map(int, input().split())]
f = lambda p: exit(print(['pairwise', 'setwise', 'not'][p] + ' coprime'))
from math import *
g = l[0]
for x in l:
	g = gcd(g, x)
if g > 1:
	f(2)
from collections import *
C = Counter()
b = 0
for x in l:
	if x % 2 < 1:
		if C[2]:
			f(1)
		C[2] = 1
	while x % 2 < 1:
		x //= 2
	for i in range(3, int(x ** 0.5) + 1, 2):
		if x % i < 1:
			if C[i]:
				f(1)
			C[i] = 1
		while x % i < 1:
			x //= i
		if x < 2:
			break
	if x > 1:
		if C[x]:
			f(1)
		C[x] = 1
f(0)


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):
	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')


n = int(input())
s = list(map(int, input().split()))
s.sort()
A = max(s)
dp = [0] * (A + 1)
for ss in s:
	dp[ss] += 1
pairwise = True
setwise = True
for i in range(2, A + 1):
	cnt = 0
	for j in range(i, A + 1, i):
		cnt += dp[j]
	if cnt > 1:
		pairwise = False
	if cnt == n:
		setwise = False
		break
if pairwise:
	print('pairwise coprime')
elif setwise:
	print('setwise coprime')
else:
	print('not coprime')


import sys
import math
from functools import reduce
N = str(input())
A = list(map(int, input().split()))
M = 10 ** 6
sieve = [0] * (M + 1)
for a in A:
	sieve[a] += 1

def gcd(*numbers):
	return reduce(math.gcd, numbers)
d = 0
for i in range(2, M + 1):
	tmp = 0
	for j in range(i, M + 1, i):
		tmp += sieve[j]
	if tmp > 1:
		d = 1
		break
if d == 0:
	print('pairwise coprime')
	exit()
if gcd(*A) == 1:
	print('setwise coprime')
	exit()
print('not coprime')


import math

def primes(N):
	p = [False, False] + [True] * (N - 1)
	for i in range(2, int(N ** 0.5) + 1):
		if p[i]:
			for j in range(i * 2, N + 1, i):
				p[j] = False
	return [i for i in range(N + 1) if p[i]]
N = int(input())
A = list(map(int, input().split()))
maxA = max(A) + 1
(g, Ac) = (A[0], [0] * maxA)
P = primes(maxA)
for a in A:
	Ac[a] += 1
ans = 'pairwise'
for p in P:
	if sum(Ac[p:maxA:p]) > 1:
		ans = 'setwise'
for a in A:
	g = math.gcd(g, a)
print(ans if g == 1 else 'not', 'coprime')


import math
N = int(input())
A = list(map(int, input().split()))
M = [0] * (10 ** 6 + 1)
g = A[0]
for i in A:
	M[i] += 1
	g = math.gcd(g, i)
if g > 1:
	print('not coprime')
	exit()
for i in range(2, 10 ** 6 + 1):
	c = 0
	for j in range(i, 10 ** 6 + 1, i):
		c += M[j]
	if c > 1:
		print('setwise coprime')
		exit()
print('pairwise 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')
			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')


import sys

def I():
	return int(sys.stdin.readline().rstrip())

def LI():
	return list(map(int, sys.stdin.readline().rstrip().split()))
N = I()
A = LI()
from math import gcd
g = 0
for i in range(N):
	g = gcd(g, A[i])
if g != 1:
	print('not coprime')
	exit()
B = [0] * (10 ** 6 + 1)
for i in range(N):
	B[A[i]] += 1
for d in range(2, 5 * 10 ** 5 + 1):
	a = sum((B[i] for i in range(d, 10 ** 6 + 1, d)))
	if a >= 2:
		print('setwise coprime')
		break
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
pairwise = True
for i in range(2, 10 ** 6 + 1):
	cnt = sum(num[i::i])
	if cnt == n:
		print('not coprime')
		exit()
	if cnt > 1:
		pairwise = False
if pairwise:
	print('pairwise coprime')
else:
	print('setwise 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')


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
import math
sys.setrecursionlimit(10 ** 9)
n = int(input())
a = list(map(int, input().split()))
ma = max(a)
p = [0] * (ma + 1)
for i in a:
	p[i] += 1
pairwise = True
for i in range(2, ma + 1):
	cnt = 0
	for j in range(i, ma + 1, i):
		cnt += p[j]
	if cnt > 1:
		pairwise = False
		break
if pairwise:
	print('pairwise coprime')
else:
	temp = a[0]
	for i in a:
		temp = math.gcd(temp, i)
	if temp == 1:
		print('setwise coprime')
	else:
		print('not coprime')


if True:
	N = int(input())
	As = list(map(int, input().split()))
	maxA = 10 ** 6 + 6
	c = [0] * (maxA + 1)
	for A in As:
		c[A] += 1
	isPrime = True
	cnt = 0
	for i in range(2, maxA + 1):
		cnt = sum(c[i::i])
		if cnt == N:
			print('not coprime')
			break
		if cnt >= 2:
			isPrime = False
	else:
		if isPrime:
			print('pairwise coprime')
		else:
			print('setwise 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
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')
	exit()
if before == 1:
	print('setwise coprime')
else:
	print('not coprime')


n = input()
g = 0
l = [0] * (10 ** 6 + 1)
from math import gcd
for i in map(int, input().split()):
	l[i] += 1
	g = gcd(i, g)
if g != 1:
	print('not coprime')
elif all((sum(l[d::d]) <= 1 for d in range(2, 10 ** 6 + 1))):
	print('pairwise coprime')
else:
	print('setwise coprime')


from math import gcd
from functools import reduce
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
if reduce(gcd, a) != 1:
	print('not coprime')
	exit()

def primes(x):
	ret = []
	for i in range(1, int(x ** 0.5) + 1):
		if x % i == 0:
			ret.append(i)
			if x // i != i:
				ret.append(x // i)
	ret.sort()
	return ret[1:]
s = set()
for q in a:
	p = primes(q)
	for j in p:
		if j in s:
			print('setwise coprime')
			exit()
		s.add(j)
print('pairwise 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]:
		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 = 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 math import gcd
N = int(input())
A = list(map(int, input().split()))
g = 0
for a in A:
	g = gcd(g, a)
if g > 1:
	print('not coprime')
	exit()

def factorize(n):
	d = set()
	m = 2
	while m * m <= n:
		while n % m == 0:
			n //= m
			d.add(m)
		m += 1
	if n > 1:
		d.add(n)
	return d
st = set()
for a in A:
	fac = factorize(a)
	if fac & st:
		print('setwise coprime')
		exit()
	st |= fac
print('pairwise coprime')


n = int(input())
(*A,) = map(int, input().split())
m = max(A)
C = [0 for a in range(m + 1)]
for a in A:
	C[a] += 1
s = 0
for a in range(2, m + 1):
	s = max(s, sum(C[a::a]))
if s < 2:
	print('pairwise coprime')
elif s < n:
	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
INF = float('inf')
ans1 = 'pairwise coprime'
ans2 = 'setwise coprime'
ans3 = 'not coprime'
n = int(input())
A = list(map(int, input().split()))
P = [0] * (10 ** 6 + 1)
for i in A:
	P[i] += 1
pairwise = True
for i in range(2, 10 ** 6 + 1):
	cnt = 0
	for j in range(i, 10 ** 6 + 1, i):
		cnt += P[j]
	if cnt > 1:
		pairwise = False
		break
if pairwise:
	print(ans1)
	exit()
g = math.gcd(A[0], A[1])
for i in A:
	g = math.gcd(g, i)
if g == 1:
	print(ans2)
else:
	print(ans3)


from math import gcd
N = int(input())
A = list(map(int, input().split()))
g = gcd(A[0], A[1])
for i in A:
	g = gcd(g, i)
if g > 1:
	print('not coprime')
	exit()
l = [0] * 1000001
for i in A:
	l[i] += 1
for i in range(2, 1000000):
	c = 0
	for j in range(i, 1000001, i):
		c += l[j]
	if c > 1:
		print('setwise coprime')
		break
else:
	print('pairwise coprime')


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()
gcd_a = reduce(math.gcd, A)
if gcd_a != 1:
	ans = 'not coprime'
else:
	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
	ans = 'pairwise coprime'
	for a in A:
		aa = osa_k(a)
		if used & aa:
			ans = 'setwise coprime'
			break
		used |= aa
print(ans)


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()
pri = 10 ** 6 + 10
gcd_a = reduce(math.gcd, A)
if gcd_a != 1:
	ans = 'not coprime'
else:
	ans = 'pairwise coprime'
	for a in A:
		aa = soinsu_bunkai(a)
		if used & aa:
			print('setwise coprime')
			return
		used |= aa
print(ans)


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
n = int(input())
s = list(map(int, input().split()))
s.sort()
dp = [0] * (10 ** 6 + 100)
res = s[0]
for ss in s:
	dp[ss] += 1
	res = gcd(res, ss)
A = max(s)
pairwise = True
setwise = res == 1
for i in range(2, A + 1):
	cnt = 0
	for j in range(i, A + 1, i):
		cnt += dp[j]
	if cnt > 1:
		pairwise = False
		break
if pairwise:
	print('pairwise coprime')
elif setwise:
	print('setwise coprime')
else:
	print('not coprime')


from collections import defaultdict
from math import gcd

def solve():
	N = int(input())
	A = list(map(int, input().split()))
	all = 0
	for a in A:
		all = gcd(all, a)
	if all != 1:
		return 'not coprime'
	M = 10 ** 6
	B = defaultdict(int)
	for a in A:
		B[a] += 1
	for i in range(2, M + 1):
		cnt = 0
		for j in range(i, M, i):
			cnt += B[j]
		if cnt > 1:
			return 'setwise coprime'
	return 'pairwise coprime'
print(solve())


from math import gcd
from functools import reduce
(N, *A) = 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')
	exit()
if reduce(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')


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 ** 0.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
	for An in A:
		if An == 1:
			continue
		not_pairwise_coprime = False
		while prime[An] != 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
	else:
		print('pairwise coprime')
		return
	if setwise_coprime == 1:
		print('setwise coprime')
	else:
		print('not coprime')

def __starting_point():
	main()
__starting_point()


n = int(input())
A = tuple(map(int, input().split()))
maxa = max(A)
cnt = [0] * (maxa + 1)
for a in A:
	cnt[a] += 1
from math import gcd
from functools import reduce
if reduce(gcd, A) != 1:
	print('not coprime')
else:
	for i in range(2, maxa + 1):
		if sum(cnt[i::i]) > 1:
			print('setwise coprime')
			break
	else:
		print('pairwise coprime')


from functools import reduce
from math import gcd

def main():
	n = int(input())
	A = list(map(int, input().split()))
	C = [0] * 1000001
	for a in A:
		C[a] += 1
	if reduce(gcd, A) != 1:
		print('not coprime')
	elif all((sum(C[i::i]) <= 1 for i in range(2, 1000001))):
		print('pairwise coprime')
	else:
		print('setwise coprime')
main()


N = int(input())
A = list(map(int, input().split()))
M = max(A) + 1
counts = [0 for _ in range(M)]
for a in A:
	counts[a] += 1
integers = [1 for _ in range(M)]
integers[0] = 0
integers[1] = 0
max_count = 0
for i in range(M):
	if integers[i] >= 1:
		count = 0
		for j in range(i, M, i):
			count += counts[j]
			integers[j] = 0
		max_count = max(max_count, count)
if max_count == N:
	answer = 'not coprime'
elif max_count >= 2:
	answer = 'setwise coprime'
else:
	answer = 'pairwise coprime'
print(answer)


from sys import stdin, stdout
from math import gcd
N = 10 ** 6 + 2
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
mp = [0] * N
not_pairwise = 1
for v in a:
	mp[v] += 1
for i in range(2, N):
	if sum(mp[i::i]) > 1:
		not_pairwise = 0
		break
g = a[0]
for v in a:
	g = gcd(g, v)
if not_pairwise:
	print('pairwise coprime')
elif g == 1:
	print('setwise coprime')
else:
	print('not coprime')


from math import gcd
n = int(input())
a = list(map(int, input().split()))
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')


import math
n = int(input().rstrip())
a = list(map(int, input().rstrip().split()))
NUM = 1000005
aa = [0] * NUM
pgcd = True
sgcd = a[n - 1]
aa[a[n - 1]] += 1
for i in range(0, n - 1):
	sgcd = math.gcd(sgcd, a[i])
	aa[a[i]] += 1
for i in range(2, NUM):
	tmp = sum(aa[i::i])
	if tmp >= 2:
		pgcd = False
		break
if sgcd != 1:
	print('not coprime')
elif pgcd:
	print('pairwise coprime')
else:
	print('setwise coprime')


from math import gcd
from functools import reduce
NUM_MAX = 10 ** 6 + 1

def solve(n, a):
	c = [0] * NUM_MAX
	for x in a:
		c[x] += 1
	t = any((sum(c[i::i]) > 1 for i in range(2, NUM_MAX)))
	t += reduce(gcd, a) > 1
	return ['pairwise', 'setwise', 'not'][t] + ' coprime'
n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))


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
N = int(input())
A = list(map(int, input().split()))

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')


_ = input()
A = [*map(int, input().split())]
C = [0] * 1000001
for a in A:
	C[a] += 1
from functools import reduce
from math import gcd
t = any((sum(C[i::i]) > 1 for i in range(2, 1000001)))
t += reduce(gcd, A) > 1
print(['pairwise', 'setwise', 'not'][t], '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 functools import reduce
from math import gcd
n = int(input())
aa = list(map(int, input().split()))
ma = max(aa)
cnt = [0] * (ma + 1)
for a in aa:
	cnt[a] += 1
if reduce(gcd, aa) != 1:
	print('not coprime')
elif all([sum(cnt[i::i]) <= 1 for i in range(2, ma)]):
	print('pairwise coprime')
else:
	print('setwise coprime')


from math import gcd
n = int(input())
maxA = 10 ** 6 + 5
A = list(map(int, input().split()))
c = [0] * maxA
for a in A:
	c[a] += 1
for i in range(2, maxA):
	cnt = 0
	for j in range(i, maxA, i):
		cnt += c[j]
	if cnt >= 2:
		break
else:
	print('pairwise coprime')
	exit()
g = A[0]
for a in A[1:]:
	g = gcd(g, a)
if g == 1:
	print('setwise coprime')
else:
	print('not coprime')


from math import gcd
n = int(input())
a = list(map(int, input().split()))
MAX = max(a)
d = {}
g = 0
for i in a:
	d[i] = 1 if i not in d else d[i] + 1
	g = gcd(g, i)
if g > 1:
	print('not coprime')
else:
	for i in range(2, MAX + 1):
		f = 0
		for j in range(i, MAX + 1, i):
			f += d[j] if j in d else 0
		if f > 1:
			print('setwise coprime')
			break
	else:
		print('pairwise coprime')


N = int(input())
A = list(map(int, input().split()))
MAX = max(A)
AR = [0] * (MAX + 1)
V = [False] * (MAX + 1)
for i in range(N):
	AR[A[i]] += 1
(pairwise, setwise) = (True, True)
for i in range(2, MAX + 1):
	if V[i]:
		continue
	(cnt, j) = (0, i)
	while j < MAX + 1:
		cnt += AR[j]
		V[j] = True
		j += i
	if cnt > 1:
		pairwise = False
	if cnt == len(A):
		setwise = False
if pairwise:
	print('pairwise coprime')
elif setwise:
	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()
	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
	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, 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')


import math
N = int(input())
m = 10 ** 6 + 1
M = [0] * m
g = 0
for i in map(int, input().split()):
	M[i] += 1
	g = math.gcd(g, i)
if g > 1:
	print('not coprime')
elif all((sum(M[i::i]) <= 1 for i in range(2, m))):
	print('pairwise coprime')
else:
	print('setwise coprime')


import sys
input = sys.stdin.readline

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def calc():
	n = int(input())
	arr = list(map(int, input().split()))
	g = arr[0]
	cnt = [0] * (10 ** 6 + 1)
	for val in arr:
		g = gcd(g, val)
		cnt[val] += 1
	for i in range(2, 10 ** 6 + 1):
		tmp = 0
		for j in range(i, 10 ** 6 + 1, i):
			tmp += cnt[j]
		if tmp >= 2:
			break
	if i == 10 ** 6:
		print('pairwise coprime')
	elif g == 1:
		print('setwise coprime')
	else:
		print('not coprime')
calc()


n = int(input())
a = list(map(int, input().split()))
l = [0] * (10 ** 6 + 100)
x = 0
for m in a:
	l[m] += 1
j = 2
while j < 10 ** 6 + 1:
	c = 0
	k = 1
	while j * k <= 10 ** 6 + 1:
		if l[j * k] > 0:
			c += l[j * k]
		k += 1
	if c == n:
		print('not coprime')
		exit()
	elif c > 1:
		x = 1
	j += 1
if x == 1:
	print('setwise coprime')
else:
	print('pairwise 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')


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


import math
from functools import reduce

def gcd_list(numbers):
	return reduce(math.gcd, numbers)
N = int(input())
A = list(map(int, input().split()))
M = [0] * (10 ** 6 + 1)
for i in A:
	M[i] += 1
if gcd_list(A) > 1:
	print('not coprime')
	exit()
for i in range(2, 10 ** 6 + 1):
	c = 0
	for j in range(i, 10 ** 6 + 1, i):
		c += M[j]
	if c > 1:
		print('setwise coprime')
		exit()
print('pairwise coprime')


import math

def eratosthenes():
	erat = [0 for _ in range(max_a + 1)]
	pair = True
	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')


n = int(input())
a = list(map(int, input().split()))
c = [0] * (10 ** 6 + 1)
for i in a:
	c[i] += 1
cnt = 0
for i in range(2, 10 ** 6 + 1):
	s = sum(c[i::i])
	if s == n:
		print('not coprime')
		exit()
	elif s > 1:
		cnt += 1
if cnt > 0:
	print('setwise coprime')
else:
	print('pairwise coprime')


N = 1000001
spf = [*range(N)]
i = 2
while i * i < N:
	if spf[i] == i:
		for j in range(i * i, N, i):
			if spf[j] == j:
				spf[j] = i
	i += 1
r = 'pairwise'
n = int(input())
a = [int(x) for x in input().split() if x > '1']
if len(a) > 1:
	u = set()
	i = None
	for x in a:
		s = set()
		while x > 1:
			p = spf[x]
			if p in u:
				r = 'setwise'
			s.add(p)
			x //= p
		u |= s
		if len(a) == n:
			if i is None:
				i = s
			else:
				i &= s
	if i:
		r = 'not'
print(r, 'coprime')


N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
prime = [0] * (10 ** 6 + 1)
eratos = [True] * (A[0] + 1)
D = [0] * (A[0] + 1)
D[1] = 1
for i in range(2, A[0] + 1):
	if not eratos[i]:
		continue
	else:
		for j in range(i, A[0] + 1, i):
			if not D[j]:
				D[j] = i
			if j != i:
				eratos[j] = False
for a in A:
	while a != 1:
		x = D[a]
		while a % x == 0:
			a //= x
		prime[x] += 1
if max(prime) <= 1:
	print('pairwise coprime')
elif max(prime) != N:
	print('setwise coprime')
else:
	print('not coprime')


from functools import reduce
from math import gcd
(N, *A) = map(int, open(0).read().split())
C = [0] * (10 ** 6 + 10)
for a in A:
	C[a] += 1
if reduce(gcd, A) != 1:
	print('not coprime')
elif all((sum(C[i::i]) <= 1 for i in range(2, len(C)))):
	print('pairwise coprime')
else:
	print('setwise coprime')


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


import sys
input = sys.stdin.buffer.readline

def main():
	N = int(input())
	a = list(map(int, input().split()))
	pr = [0] * (max(a) + 1)
	flag = True
	for num in a:
		pr[num] += 1
	for i in range(2, max(a) + 1):
		count = sum(pr[i::i])
		if count == N:
			print('not coprime')
			exit()
		elif count > 1:
			flag = False
	if flag:
		print('pairwise coprime')
	else:
		print('setwise coprime')
main()


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


n = int(input())
l = [*map(int, input().split())]
from math import *
g = l[0]
for x in l:
	g = gcd(g, x)
if g > 1:
	exit(print('not coprime'))
from collections import *
d = Counter()
b = 0
for x in l:
	if x % 2 < 1:
		if d[2]:
			b = 1
			break
		d[2] = 1
	while x % 2 < 1:
		x //= 2
	for i in range(3, int(x ** 0.5) + 1, 2):
		if x % i < 1:
			if d[i]:
				b = 1
				break
			d[i] = 1
		while x % i < 1:
			x //= i
		if x < 2:
			break
	if x > 1:
		if d[x]:
			b = 1
			break
		d[x] = d.get(x, 0) + 1
print(['pair', 'set'][b] + 'wise 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')
		exit()
	if s > 1:
		f = 0
if f == 0:
	print('setwise coprime')
else:
	print('pairwise coprime')


N = int(input())
A = list(map(int, input().split()))
number_to_prime = [0] * (10 ** 6 + 1)
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
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')


from math import gcd
N = int(input())
A = list(map(int, input().split()))
g = 0
for a in A:
	g = gcd(g, a)
if g > 1:
	print('not coprime')
	exit()
MAXA = 10 ** 6
B = [0] * (MAXA + 1)
for a in A:
	if a == 1:
		continue
	if B[a]:
		print('setwise coprime')
		exit()
	B[a] = 1
for n in range(2, MAXA + 1):
	c = 0
	for m in range(n, MAXA + 1, n):
		c += B[m]
		if c > 1:
			print('setwise coprime')
			exit()
print('pairwise coprime')


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)]
	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]
			if count > 1:
				is_pairwise = False
	if is_pairwise:
		print('pairwise coprime')
		return
	value_gcd = 0
	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()


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 = A[0]
while prime[a]:
	st.add(prime[a])
	x = prime[a]
	while a % x == 0:
		a //= x
pairwise = True
st2 = st
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')


import math
N = int(input())
A = list(map(int, input().split()))
m = max(A)
c = [0] * (m + 1)
for i in A:
	c[i] += 1
pairwise = True
for i in range(2, m + 1, 1):
	cnt = 0
	for j in range(i, m + 1, i):
		cnt += c[j]
	if cnt > 1:
		pairwise = False
if pairwise:
	print('pairwise coprime')
	exit()
g = 0
for i in range(N):
	g = math.gcd(g, A[i])
if g == 1:
	print('setwise coprime')
	exit()
print('not coprime')


from math import gcd
n = int(input())
a = list(map(int, input().split()))
u = 0
for i in a:
	u = gcd(u, i)
if u != 1:
	print('not coprime')
	exit()
vis = [False] * (10 ** 6 + 1)
for i in a:
	vis[i] = True
cnt = [0] * (10 ** 6 + 1)
for i in range(1, 10 ** 6 + 1):
	for j in range(1, 10 ** 6 + 1):
		if i * j > 10 ** 6:
			break
		if vis[i * j]:
			cnt[i] += 1
if max(cnt[2:]) <= 1:
	print('pairwise coprime')
else:
	print('setwise coprime')


from math import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
M = 10 ** 6 + 1
mp = [0] * M
for a in A:
	mp[a] += 1
pairwise = 1
for i in range(2, M):
	if sum(mp[i::i]) > 1:
		pairwise = 0
		break
if pairwise:
	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()))
max_a = max(a)
cnt_a = [0] * (max_a + 1)
for ai in a:
	cnt_a[ai] += 1
ans = 'pairwise'
for i in range(2, max_a + 1):
	cnt = 0
	for j in range(i, max_a + 1, i):
		cnt += cnt_a[j]
	if cnt > 1:
		ans = 'setwise'
g = 0
for ai in a:
	g = gcd(g, ai)
if ans == 'pairwise':
	print(ans, 'coprime')
elif ans == 'setwise' and g == 1:
	print(ans, 'coprime')
else:
	print('not coprime')


from math import gcd
from collections import defaultdict
upper = 10 ** 6
N = int(input())
A = list(map(int, input().split()))
num = defaultdict(int)
g = 0
for a in A:
	g = gcd(g, a)
	num[a] += 1
isStopped = False
for i in range(2, upper + 1):
	x = 0
	for j in range(i, upper + 1, i):
		x += num[j]
	if x >= 2:
		isStopped = True
		break
if not isStopped:
	print('pairwise coprime')
elif g == 1:
	print('setwise coprime')
else:
	print('not coprime')


import math
N = int(input())
A = list(map(int, input().split()))
C = [0] * (10 ** 6 + 1)
for i in range(N):
	C[A[i]] += 1
is_pairwise = True
max_a = max(A) + 1
X = [0] * max_a
for i in range(2, max_a):
	count = 0
	for j in range(i, max_a, i):
		count += C[j]
	if count > 1:
		is_pairwise = False
if is_pairwise:
	print('pairwise coprime')
	exit()
tmp = A[0]
for i in range(1, N):
	tmp = math.gcd(tmp, A[i])
if tmp == 1:
	print('setwise coprime')
else:
	print('not coprime')


from collections import Counter
N = int(input())
A = list(map(int, input().split()))
x = max(A)
hurui = [x] * (x + 1)
for i in range(2, x + 1):
	for j in range(i, x + 1, i):
		hurui[j] = min(i, hurui[j])
cnt = Counter([1])
for i in range(N):
	num = A[i]
	while num > 1:
		x = hurui[num]
		while num % x == 0:
			num //= x
		cnt[x] += 1
a = cnt.most_common(1)[0][1]
if a == 1:
	print('pairwise coprime')
elif a < N:
	print('setwise coprime')
else:
	print('not coprime')


import math
N = int(input())
A = list(map(int, input().split()))
maxA = max(A) + 1
C = [0] * maxA
g = 0
for a in A:
	C[a] += 1
	g = math.gcd(g, a)
pairwise = True
is_prime = [True] * maxA
for i in range(2, maxA):
	if is_prime[i]:
		cnt = 0
		for j in range(i, maxA, i):
			cnt += C[j]
			is_prime[j] = False
		if cnt > 1:
			pairwise = False
if pairwise:
	print('pairwise coprime')
	exit()
if g == 1:
	print('setwise coprime')
else:
	print('not 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')


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')


N = int(input())
A = list(map(int, input().split()))
Amax = max(A)
lis = [0] * (Amax + 1)
for i in range(N):
	lis[A[i]] += 1
setwise = False
for t in range(2, Amax + 1):
	p = t
	cnt = 0
	while p <= Amax:
		cnt += lis[p]
		p += t
	if cnt == N:
		print('not coprime')
		break
	if 2 <= cnt < N:
		setwise = True
else:
	if setwise == True:
		print('setwise coprime')
	else:
		print('pairwise coprime')


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')
N = int(input())
A = [int(x) for x in input().split()]
solve(A)


N = int(input())
A = list(map(int, input().split()))
cnt = [0] * (10 ** 6 + 1)
for i in range(N):
	cnt[A[i]] += 1
flag = True
for i in range(2, 10 ** 6 + 1):
	multiple = 0
	for j in range(i, 10 ** 6 + 1, i):
		multiple += cnt[j]
	if multiple == N:
		print('not coprime')
		exit()
	if multiple >= 2:
		flag = False
print('pairwise coprime' if flag else 'setwise coprime')


from math import gcd
n = int(input())
a = [int(i) for i in input().split()]
g = a[0]
for i in range(n):
	g = gcd(g, a[i])
if g != 1:
	print('not coprime')
	exit()
m = max(a)
fac = [1] * (m + 1)
for i in range(2, m + 1):
	if fac[i] != 1:
		continue
	for j in range(i, m + 1, i):
		fac[j] = i
s = set()
for i in range(n):
	x = fac[a[i]]
	if x == 1:
		continue
	if x in s:
		print('setwise coprime')
		exit()
	s.add(x)
print('pairwise coprime')


from math import gcd
N = int(input())
A = list(map(int, input().split()))
v = 0
for a in A:
	v = gcd(a, v)
if v > 1:
	print('not coprime')
	raise SystemExit
V = set()
for v in A:
	for i in range(2, v + 1):
		if i * i > v:
			break
		if v % i == 0:
			if v in V:
				print('setwise coprime')
				raise SystemExit
			V.add(v)
			while v % i == 0:
				v //= i
	if v != 1:
		if v in V:
			print('setwise coprime')
			raise SystemExit
		V.add(v)
print('pairwise coprime')


n = int(input())
a = list(map(int, input().split()))
M = max(a) + 1
if M == 2:
	print('pairwise coprime')
	exit()
count = [0] * M
for i in range(2, M):
	if count[i] == 0:
		for j in range(i, M, i):
			if count[j] == 0:
				count[j] = i
check = [0] * M
for i in a:
	x = i
	while x > 1:
		check[count[x]] += 1
		y = count[x]
		while x % y == 0:
			x //= y
ans = max(check)
if ans == 1:
	print('pairwise coprime')
elif ans == n:
	print('not coprime')
else:
	print('setwise 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
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')


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())
(*A,) = map(int, input().split())
m = max(2, max(A))
P = {p: True for p in range(2, m + 1)}
for i in range(2, m + 1):
	for j in range(2 * i, m + 1, i):
		P[j] = False
Pmap = {p: 0 for p in P if P[p]}
Amap = {a: 0 for a in range(1, m + 1)}
for a in A:
	Amap[a] += 1
for p in Pmap:
	for a in range(p, m + 1, p):
		Pmap[p] += Amap[a]
s = max(Pmap.values())
if s < 2:
	print('pairwise coprime')
elif s < n:
	print('setwise coprime')
else:
	print('not coprime')


import math as mt
I = lambda : list(map(int, input().split()))
mod = 10 ** 9
(n,) = I()
l = I()
x = 0
y = 0
temp = l[0]
for i in range(1, n):
	temp = mt.gcd(temp, l[i])
N = 10 ** 6 + 3
ss = [0] * N
ss[0] = 1
for i in range(2, N):
	if ss[i] == 0:
		ss[i] = i
		for j in range(2 * i, N, i):
			ss[j] = i
if temp != 1:
	print('not coprime')
else:
	pos = 1
	visi = [0] * N
	for i in range(n):
		now = l[i]
		while now > 1:
			te = ss[now]
			if visi[te]:
				pos = 0
				break
			while now % te == 0:
				now //= te
			visi[te] = 1
		if not pos:
			break
	if pos:
		print('pairwise coprime')
	else:
		print('setwise coprime')


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')


import sys
from math import gcd
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
mx = max(a)
table = [0] * (mx + 1)
for x in a:
	table[x] += 1
g = 0
for x in a:
	g = gcd(g, x)
for i in range(2, mx + 1):
	c = 0
	for j in range(i, mx + 1, i):
		c += table[j]
	if c > 1:
		if g == 1:
			print('setwise coprime')
		else:
			print('not coprime')
		exit(0)
print('pairwise coprime')


import sys

def input() -> str:
	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])


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 sys

def input():
	return sys.stdin.readline().rstrip()

class Sieve:

	def __init__(self, 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):
		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):
	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()


(n, a) = (int(input()), list(map(int, input().split())))
g = 0
from math import gcd
for i in a:
	g = gcd(i, g)
if g != 1:
	print('not coprime')
else:
	from collections import defaultdict
	memo = defaultdict(int)
	for i in a:
		for p in range(2, int(i ** 0.5) + 1):
			if i % p == 0:
				while i % p == 0:
					i //= p
				if memo[p]:
					print('setwise coprime')
					exit()
				memo[p] += 1
		if i != 1:
			if memo[i]:
				print('setwise coprime')
				exit()
			memo[i] += 1
	print('pairwise coprime')


N = int(input())
A = list(map(int, input().split()))
number_to_prime = [0] * (10 ** 6 + 1)
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')


import sys

def input():
	return sys.stdin.readline().rstrip()
N = int(input())
A = list(map(int, input().split()))
A_max = max(A)
prime = [[] for _ in range(A_max + 1)]
for i in range(2, A_max + 1):
	if prime[i] == []:
		n = i
		while n <= A_max:
			prime[n].append(i)
			n += i
li = [0] * (A_max + 1)
for a in A:
	for p in prime[a]:
		li[p] += 1
if max(li) <= 1:
	print('pairwise coprime')
elif max(li) == N:
	print('not coprime')
else:
	print('setwise coprime')


n = int(input())
a = list(map(int, input().split()))
li = [0] * 1100000
is_prime = [True] * 1100000
is_prime[0] = is_prime[1] = False
for i in a:
	li[i] += 1
is_pairwise = True
for i in range(2, 1100000):
	if is_prime[i]:
		cnt = 0
		for j in range(i, 1100000, i):
			is_prime[j] = False
			cnt += li[j]
		if cnt == n:
			print('not coprime')
			exit()
		if cnt > 1:
			is_pairwise = False
if is_pairwise:
	print('pairwise coprime')
else:
	print('setwise coprime')


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
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')


from math import gcd
N = int(input())
A = list(map(int, input().split()))
exist = [0] * (10 ** 6 + 1)
for a in A:
	exist[a] += 1
g = A[0]
for a in A[1:]:
	g = gcd(g, a)
if g != 1:
	print('not coprime')
elif all([sum(exist[i::i]) <= 1 for i in range(2, 10 ** 6 + 1)]):
	print('pairwise coprime')
else:
	print('setwise 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()))
A.sort()
Amax = A[-1]
Fnum_list2 = primes(Amax)
j = A[0]
ans = 1
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')
elif ans == 2:
	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
C = [0] * c
f = 1
for i in A:
	C[i] += 1
for i in range(2, c):
	cnt = 0
	for j in range(i, c, i):
		cnt += C[j]
	if cnt > 1:
		f = 0
if f == 1:
	print('pairwise coprime')
elif reduce(gcd, A) == 1:
	print('setwise coprime')
else:
	print('not coprime')


N = int(input())
A = [int(i) for i in input().split()]
maxA = max(A)
pn = list(range(maxA + 1))
n = 2
while n * n <= maxA:
	if n == pn[n]:
		for m in range(n, len(pn), n):
			if pn[m] == m:
				pn[m] = n
	n += 1
s = set()
for a in A:
	st = set()
	while a > 1:
		st.add(pn[a])
		a //= pn[a]
	if not s.isdisjoint(st):
		break
	s |= st
else:
	print('pairwise coprime')
	exit()
from math import gcd
n = gcd(A[0], A[1])
for a in A[2:]:
	n = gcd(n, a)
if n == 1:
	print('setwise coprime')
else:
	print('not 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 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)
		elif gcd_list(a) == 1:
			print('setwise coprime')
			return
		else:
			print('not coprime')
			return
print('pairwise coprime')


M = 10 ** 6 + 1
f = lambda p: exit(print(['pairwise', 'setwise', 'not'][p] + ' coprime'))
n = int(input())
l = [*map(int, input().split())]
g = 0
from math import *
for x in l:
	g = gcd(g, x)
if g > 1:
	f(2)

def sieve(x):
	p = []
	s = [0] * x
	for i in range(2, x):
		if s[i] < 1:
			p += [i]
			for j in range(i, x, i):
				s[j] = i
	return s
s = sieve(M)
C = [0] * M
for x in l:
	t = set()
	while x > 1:
		t.add(s[x])
		x //= s[x]
	for y in t:
		if C[y]:
			f(1)
		C[y] = 1
f(0)


import math
n = int(input())
a = list(map(int, input().split()))
table = [0 for i in range(10 ** 6 + 7)]
flag = 0
for i in a:
	table[i] += 1
for i in range(2, 10 ** 6 + 1):
	cnt = 0
	j = i
	while j < 10 ** 6 + 1:
		cnt += table[j]
		j += i
	if cnt > 1:
		flag = 1
		break
if flag == 1:
	tmp = a[0]
	for i in range(1, n):
		tmp = math.gcd(tmp, a[i])
	if tmp == 1:
		flag = 2
if flag == 0:
	print('pairwise coprime')
if flag == 1:
	print('not coprime')
if flag == 2:
	print('setwise 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')


import math
import sys
n = int(input())
a = list(map(int, input().split()))
ga = a[0]
for i in range(n):
	ga = math.gcd(ga, a[i])
if ga != 1:
	print('not coprime')
	sys.exit()
m = 1000000
b = [0] * (m + 1)
for i in range(2, m):
	if b[i] != 0:
		continue
	j = 1
	while True:
		t = i * j
		if t > m:
			break
		if b[t] == 0:
			b[t] = i
		j += 1
d = {}
for i in a:
	p = i
	while p != 1:
		if p in d:
			print('setwise coprime')
			sys.exit()
		d[p] = 1
		p = int(p / b[p])
print('pairwise coprime')


import math
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
Nums = [0] * (10 ** 6 + 1)
for a in A:
	Nums[a] += 1
GCD = A[0]
for i in range(N - 1):
	GCD = math.gcd(GCD, A[i + 1])
if GCD != 1:
	print('not coprime')
else:
	for d in range(2, 10 ** 6 + 1):
		cnt = sum(Nums[d::d])
		if cnt > 1:
			print('setwise coprime')
			exit()
	print('pairwise 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')


n = int(input())
import copy
a = [int(x) for x in input().split()]
MAX_A = 10 ** 6 + 1
histogram = [0] * MAX_A
for x in a:
	histogram[int(x)] += 1
for divider in range(2, MAX_A):
	count = 0
	for counted in histogram[divider::divider]:
		count += counted
	if count > 1:
		break
else:
	print('pairwise coprime')
	exit()
from math import gcd
g = gcd(a[0], a[1])
if n == 2:
	print('setwise coprime' if g == 1 else 'not coprime')
	exit()
for i in range(2, n):
	g = gcd(g, a[i])
if g == 1:
	print('setwise coprime')
else:
	print('not coprime')


def factorize(x):
	f = set()
	if x % 2 == 0:
		f.add(2)
	while x % 2 == 0:
		x //= 2
	p = 3
	while x >= p * p:
		if x % p == 0:
			f.add(p)
		while x % p == 0:
			x //= p
		p += 2
	if x > 1:
		f.add(x)
	return f
N = int(input())
A = list(map(int, input().split()))
F = [0] * (10 ** 6 + 5)
for a in A:
	for f in factorize(a):
		F[f] += 1
m = max(F)
if m <= 1:
	print('pairwise coprime')
elif m < N:
	print('setwise coprime')
else:
	print('not coprime')


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')


N = int(input())
li = list(map(int, input().split()))
S = max(li)
L = [0] * (S + 1)
import math
from functools import reduce
if reduce(math.gcd, li) != 1:
	print('not coprime')
	exit()
for i in li:
	L[i] = 1
for k in range(2, S + 1):
	t = 0
	for j in range(0, S + 1, k):
		t += L[j]
	if t > 1:
		print('setwise coprime')
		exit()
print('pairwise coprime')


import math
n = input()
As = list(map(int, input().split()))
gcd = As[0]
for a in As[1:]:
	tmp = gcd
	gcd = math.gcd(tmp, a)
if gcd > 1:
	print('not coprime')
	exit()
era = [0] * (10 ** 6 + 1)
for a in As:
	era[a] += 1
for d in range(2, 10 ** 6 + 1):
	data = [i for i in range(d, 10 ** 6 + 1, d)]
	cnt = 0
	for i in data:
		cnt += era[i]
	if cnt > 1:
		print('setwise coprime')
		exit()
print('pairwise coprime')


n = int(input())
a = list(map(int, input().split()))
r = max(a) + 1
s = []
t = [0] * r
for i in range(r):
	s.append([])
for i in range(2, r):
	if s[i] == []:
		for j in range(1, -(-r // i)):
			s[i * j].append(i)
for i in range(n):
	for j in range(len(s[a[i]])):
		t[s[a[i]][j]] += 1
if max(t) == n:
	print('not coprime')
elif max(t) <= 1:
	print('pairwise coprime')
else:
	print('setwise 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)
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')


import math
N = int(input())
A = list(map(int, input().split()))
MAX_INT = 10 ** 6
f1 = [0] * (MAX_INT + 1)
for a in A:
	f1[a] += 1
flg = True
for i in range(2, MAX_INT + 1):
	cnt = 0
	for j in range(i, MAX_INT + 1, i):
		cnt += f1[j]
	if cnt > 1:
		flg = False
		break
if flg:
	print('pairwise coprime')
	exit()
g = A[0]
for i in range(1, N):
	g = math.gcd(g, A[i])
if g == 1:
	print('setwise coprime')
else:
	print('not coprime')


from fractions import gcd
N = int(input())
As = list(map(int, input().split()))
A = max(As)
lst = [0] * (A + 1)
rlt = [0] * (A + 1)
for i in range(2, A + 1):
	if lst[i] > 0:
		continue
	j = 1
	while i * j <= A:
		if lst[i * j] == 0:
			lst[i * j] = i
		j += 1
	if j == 1:
		break
for a in As:
	tmp = -1
	while a > 1:
		if tmp != lst[a]:
			rlt[lst[a]] += 1
			tmp = lst[a]
		a //= lst[a]
r = max(rlt)
if r < 2:
	print('pairwise coprime')
elif r < N:
	print('setwise coprime')
else:
	print('not coprime')


n = int(input())
a = list(map(int, input().split()))
s = set()
f = 1
for x in a:
	if f == 0:
		break
	if x > 1:
		r = int(x ** 0.5 + 1e-08) + 1
		for i in range(2, r):
			if x % i == 0:
				while x % i == 0:
					x //= i
				if i in s:
					f = 0
					break
				else:
					s.add(i)
		if x > 1:
			if x in s:
				f = 0
				break
			else:
				s.add(x)
if f:
	print('pairwise coprime')
	exit()
p = a[0]
from math import gcd
for x in a:
	p = gcd(p, x)
if p == 1:
	print('setwise coprime')
else:
	print('not coprime')


import sys
readline = sys.stdin.readline
read = sys.stdin.read
(n, *a) = map(int, read().split())
M = 10 ** 6
r = [0] * (M + 1)
for i in a:
	r[i] += 1
isp = True
for x in range(2, M + 1):
	c = sum(r[x::x])
	if c == n:
		print('not coprime')
		exit()
	if c >= 2:
		isp = False
else:
	if isp:
		print('pairwise coprime')
	else:
		print('setwise coprime')