import math



eval(input())

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

         

N = max(a) + 1

 

spf = [*list(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'

 

d = None

u = set()

for x in a:

  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(((r, 'not')[d > 1], 'coprime'))

import math

 

N = 1000001

 

spf = [*list(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'

 

eval(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(((r, 'not')[d > 1], 'coprime'))

import math

eval(input())
a = (*list(map(int, input().split())),)
N = max(a) + 1
spf = [*list(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"
d = None
u = set()
for x in a:
    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(((r, "not")[d > 1], "coprime"))

import math

N = 1000001
spf = [*list(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"
eval(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(((r, "not")[d > 1], "coprime"))

-eval(input()) -a = (*list(map(int, input().split())),) -N = max(a) + 1 +N = 1000001 +eval(input()) -for x in a: +for x in map(int, input().split()):