n = int(eval(input()))

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

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



from bisect import bisect_left



n0 = 10**6

primes = set(range(2, n0+1))

for i in range(2, int(n0**0.5+1)):

    primes.difference_update(list(range(i*2, n0+1, i)))

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

for p in primes:

    primeind[p]=1



def isPrime(m):

    return primeind[m]==1



def func(m):

    for i in range(2,int(m**0.5)+1):

        if isPrime(m):

            break

        if m%i==0:

            mapa[i]+=1

        while m%i==0:

            m//=i

        if m<i:

            break

    if m>1:

        mapa[m]+=1



for ai in a:

    func(ai)



tmp=max(mapa)

#print(mapa[:20])

if tmp==n:

    print('not coprime')

elif tmp>1:

    print('setwise coprime')

else:

    print('pairwise coprime')
n = int(eval(input()))

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

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



n0 = 10**6

primes = [0]*(n0+1)

for i in range(2, n0+1):

    if primes[i]==0:

        x=i

        multi=1

        while x<=n0:

            if primes[x]==0:

                primes[x]=i

            x//=multi

            multi+=1

            x*=multi



def func(m):

    while m>1:

        mapa[primes[m]]+=1

        pm=primes[m]

        while m>1 and m%pm==0:

            m//=pm



for ai in a:

    func(ai)



tmp=max(mapa)



if tmp==n:

    print('not coprime')

elif tmp>1:

    print('setwise coprime')

else:

    print('pairwise coprime')
n = int(eval(input()))
(*a,) = list(map(int, input().split()))
mapa = [0] * (10**6 + 1)
from bisect import bisect_left

n0 = 10**6
primes = set(range(2, n0 + 1))
for i in range(2, int(n0**0.5 + 1)):
    primes.difference_update(list(range(i * 2, n0 + 1, i)))
primeind = [0] * (10**6 + 1)
for p in primes:
    primeind[p] = 1


def isPrime(m):
    return primeind[m] == 1


def func(m):
    for i in range(2, int(m**0.5) + 1):
        if isPrime(m):
            break
        if m % i == 0:
            mapa[i] += 1
        while m % i == 0:
            m //= i
        if m < i:
            break
    if m > 1:
        mapa[m] += 1


for ai in a:
    func(ai)
tmp = max(mapa)
# print(mapa[:20])
if tmp == n:
    print("not coprime")
elif tmp > 1:
    print("setwise coprime")
else:
    print("pairwise coprime")

n = int(eval(input()))
(*a,) = list(map(int, input().split()))
mapa = [0] * (10**6 + 1)
n0 = 10**6
primes = [0] * (n0 + 1)
for i in range(2, n0 + 1):
    if primes[i] == 0:
        x = i
        multi = 1
        while x <= n0:
            if primes[x] == 0:
                primes[x] = i
            x //= multi
            multi += 1
            x *= multi


def func(m):
    while m > 1:
        mapa[primes[m]] += 1
        pm = primes[m]
        while m > 1 and m % pm == 0:
            m //= pm


for ai in a:
    func(ai)
tmp = max(mapa)
if tmp == n:
    print("not coprime")
elif tmp > 1:
    print("setwise coprime")
else:
    print("pairwise coprime")

-from bisect import bisect_left - -primes = set(range(2, n0 + 1)) -for i in range(2, int(n0**0.5 + 1)): -    primes.difference_update(list(range(i * 2, n0 + 1, i))) -primeind = [0] * (10**6 + 1) -for p in primes: -    primeind[p] = 1 - - -def isPrime(m): -    return primeind[m] == 1 +primes = [0] * (n0 + 1) +for i in range(2, n0 + 1): +    if primes[i] == 0: +        x = i +        multi = 1 +        while x <= n0: +            if primes[x] == 0: +                primes[x] = i +            x //= multi +            multi += 1 +            x *= multi -    for i in range(2, int(m**0.5) + 1): -        if isPrime(m): -            break -        if m % i == 0: -            mapa[i] += 1 -        while m % i == 0: -            m //= i -        if m < i: -            break -    if m > 1: -        mapa[m] += 1 +    while m > 1: +        mapa[primes[m]] += 1 +        pm = primes[m] +        while m > 1 and m % pm == 0: +            m //= pm -# print(mapa[:20])