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)

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)

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)

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)

-n, *l = map(int, open(0).read().split()) +n = int(input()) +l = [*map(int, input().split())] +g = 0 -g, C = 0, [0] * M -    C[x] = 1 -if any(sum(C[i::i]) > 1 for i in range(2, M)): -    f(1) + + +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