from math import gcd

from collections import deque

# = map(int, input().split())

N = int(eval(input()))

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

mA = max(A)

counter = [0 for _ in range(mA+1)]

primenum = [2]

sgn = [-1 for _ in range(int(mA**0.5)+1)]

k = 3

while k**2 <= mA:

  if sgn[k] == -1:

    primenum.append(k)

    add = k*k

    ok = k

    while ok**2 <= mA:

      sgn[ok] = 1

      ok += add

  k += 2

#prime_num が用意されているとき

def factorization(n):

  M = n

  for p in primenum:

    if p**2 > M:

      break

    else:

      if M%p == 0:

        if counter[p] == 0:

          counter[p] = 1

        else:

          return False

        while M%p == 0:

          M //= p



  if M > 1:

    if counter[M] == 0:

      counter[M] = 1

    else:

      return False

  return True







g = A[0]

flag = True

for k in range(N):

  a = A.popleft()

  g = gcd(g, a)

  if flag:

    flag = factorization(a)

  if flag == False:

    if g == 1:

      break





if flag:

  print('pairwise coprime')

  exit()

if g == 1:

  print('setwise coprime')

else:

  print('not coprime')

from math import gcd



# = map(int, input().split())

N = int(eval(input()))

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



flag = True

c2 = 0

c3 = 0

c5 = 0

for k in range(N):

  if A[k] %2 ==0:

    c2 += 1

    if c2 > 1:

      flag = False

      break

  elif A[k] %3 ==0:

    c3 += 1

    if c3 > 1:

      flag = False

      break

  elif A[k] %5 == 0:

    c5 += 1

    if c5 >1:

      flag = False

      break



if flag:

  mA = max(A)

  counter = [0 for _ in range(mA+1)]



  primenum = [2]

  sgn = [-1 for _ in range(int(mA**0.5)+1)]

  k = 3

  while k**2 <= mA:

    if sgn[k] == -1:

      primenum.append(k)

      add = k*k

      ok = k

      while ok**2 <= mA:

        sgn[ok] = 1

        ok += add

    k += 2

  #prime_num が用意されているとき

  def factorization(n):

    M = n

    for p in primenum:

      if p**2 > M:

        break

      else:

        if M%p == 0:

          if counter[p] == 0:

            counter[p] = 1

          else:

            return False

          while M%p == 0:

            M //= p



    if M > 1:

      if counter[M] == 0:

        counter[M] = 1

      else:

        return False

    return True



g = A[0]

for k in range(N):

  a = A[k]

  g = gcd(g, a)

  if flag:

    flag = factorization(a)

  if flag == False:

    if g == 1:

      break





if flag:

  print('pairwise coprime')

  exit()

if g == 1:

  print('setwise coprime')

else:

  print('not coprime')

from math import gcd
from collections import deque

# = map(int, input().split())
N = int(eval(input()))
A = deque(list(map(int, input().split())))
mA = max(A)
counter = [0 for _ in range(mA + 1)]
primenum = [2]
sgn = [-1 for _ in range(int(mA**0.5) + 1)]
k = 3
while k**2 <= mA:
    if sgn[k] == -1:
        primenum.append(k)
        add = k * k
        ok = k
        while ok**2 <= mA:
            sgn[ok] = 1
            ok += add
    k += 2
# prime_num が用意されているとき
def factorization(n):
    M = n
    for p in primenum:
        if p**2 > M:
            break
        else:
            if M % p == 0:
                if counter[p] == 0:
                    counter[p] = 1
                else:
                    return False
                while M % p == 0:
                    M //= p
    if M > 1:
        if counter[M] == 0:
            counter[M] = 1
        else:
            return False
    return True


g = A[0]
flag = True
for k in range(N):
    a = A.popleft()
    g = gcd(g, a)
    if flag:
        flag = factorization(a)
    if flag == False:
        if g == 1:
            break
if flag:
    print("pairwise coprime")
    exit()
if g == 1:
    print("setwise coprime")
else:
    print("not coprime")

from math import gcd

# = map(int, input().split())
N = int(eval(input()))
A = list(map(int, input().split()))
flag = True
c2 = 0
c3 = 0
c5 = 0
for k in range(N):
    if A[k] % 2 == 0:
        c2 += 1
        if c2 > 1:
            flag = False
            break
    elif A[k] % 3 == 0:
        c3 += 1
        if c3 > 1:
            flag = False
            break
    elif A[k] % 5 == 0:
        c5 += 1
        if c5 > 1:
            flag = False
            break
if flag:
    mA = max(A)
    counter = [0 for _ in range(mA + 1)]
    primenum = [2]
    sgn = [-1 for _ in range(int(mA**0.5) + 1)]
    k = 3
    while k**2 <= mA:
        if sgn[k] == -1:
            primenum.append(k)
            add = k * k
            ok = k
            while ok**2 <= mA:
                sgn[ok] = 1
                ok += add
        k += 2
    # prime_num が用意されているとき
    def factorization(n):
        M = n
        for p in primenum:
            if p**2 > M:
                break
            else:
                if M % p == 0:
                    if counter[p] == 0:
                        counter[p] = 1
                    else:
                        return False
                    while M % p == 0:
                        M //= p
        if M > 1:
            if counter[M] == 0:
                counter[M] = 1
            else:
                return False
        return True


g = A[0]
for k in range(N):
    a = A[k]
    g = gcd(g, a)
    if flag:
        flag = factorization(a)
    if flag == False:
        if g == 1:
            break
if flag:
    print("pairwise coprime")
    exit()
if g == 1:
    print("setwise coprime")
else:
    print("not coprime")

-from collections import deque -A = deque(list(map(int, input().split()))) -mA = max(A) -counter = [0 for _ in range(mA + 1)] -primenum = [2] -sgn = [-1 for _ in range(int(mA**0.5) + 1)] -k = 3 -while k**2 <= mA: -    if sgn[k] == -1: -        primenum.append(k) -        add = k * k -        ok = k -        while ok**2 <= mA: -            sgn[ok] = 1 -            ok += add -    k += 2 -# prime_num が用意されているとき -def factorization(n): -    M = n -    for p in primenum: -        if p**2 > M: +A = list(map(int, input().split())) +flag = True +c2 = 0 +c3 = 0 +c5 = 0 +for k in range(N): +    if A[k] % 2 == 0: +        c2 += 1 +        if c2 > 1: +            flag = False -        else: -            if M % p == 0: -                if counter[p] == 0: -                    counter[p] = 1 -                else: -                    return False -                while M % p == 0: -                    M //= p -    if M > 1: -        if counter[M] == 0: -            counter[M] = 1 -        else: -            return False -    return True +    elif A[k] % 3 == 0: +        c3 += 1 +        if c3 > 1: +            flag = False +            break +    elif A[k] % 5 == 0: +        c5 += 1 +        if c5 > 1: +            flag = False +            break +if flag: +    mA = max(A) +    counter = [0 for _ in range(mA + 1)] +    primenum = [2] +    sgn = [-1 for _ in range(int(mA**0.5) + 1)] +    k = 3 +    while k**2 <= mA: +        if sgn[k] == -1: +            primenum.append(k) +            add = k * k +            ok = k +            while ok**2 <= mA: +                sgn[ok] = 1 +                ok += add +        k += 2 +    # prime_num が用意されているとき +    def factorization(n): +        M = n +        for p in primenum: +            if p**2 > M: +                break +            else: +                if M % p == 0: +                    if counter[p] == 0: +                        counter[p] = 1 +                    else: +                        return False +                    while M % p == 0: +                        M //= p +        if M > 1: +            if counter[M] == 0: +                counter[M] = 1 +            else: +                return False +        return True -flag = True -    a = A.popleft() +    a = A[k]