Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

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

# n = 10**6
# A = [i+1 for i in range(n)]

A.sort()
p_ng = 0
l = 10**6 + 5
B = [0] * l

for i in range(2, l):
    if B[i] == 0:
        j = 2
        ind = j * i
        while ind < l:
            B[ind] = 1
            j += 1
            ind = j * i

C = [0] * l
for i in range(n):
    if A[B[i]] == 0:
        if C[B[i]] == 1:
            p_ng = 1
            break
        C[i] = 1
    else:
        a = A[i]
        w = 2
        while a != 1:
            f = 1
            while a%w == 0:
                a//=w
                if f == 1 and C[w] == 1:
                    p_ng = 1
                    break
                f = 0
                C[w] = 1
            w += 1
            # print(a,w)
            if p_ng== 1:
                break
        if p_ng == 1:
            break


# ind = 0
# while ind < n and A[ind] == 1:
#     ind += 1

# if ind < n:
#     for j in range(ind, n):
#         # print(B[:10])
#         for i in range(1, (l-1) // A[j] + 1):
#             indj = i * A[j]
#             # print(indj)
#             if i == 1 and B[indj] == 1:
#                 p_ng = 1
#                 break
#             B[indj] = 1
#         if j > 0 and A[j-1] == A[j]:
#             p_ng = 1
#             break
#         if p_ng == 1:
#             break

if p_ng == 0:
    print("pairwise coprime")
    sys.exit()

from math import gcd
g = A[0]
for i in range(1, n):
    g = gcd(g, A[i])

if g == 1:
    print("setwise coprime")
else:
    print("not coprime")
    


Fixed submission:
import sys
input = sys.stdin.readline

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

# n = 10**6
# A = [i+1 for i in range(n)]

A.sort()
p_ng = 0
l = 10**6 + 5
B = [0] * l

B[0] = 1
B[1] = 1

for i in range(2, l):
    if B[i] == 0:
        j = 2
        ind = j * i
        while ind < l:
            B[ind] = 1
            j += 1
            ind = j * i

# for i in range(100):
#     print(i, B[i])

C = [0] * l
for i in range(n):
    # print(i, A[i])
    if A[B[i]] == 0:
        if C[B[i]] == 1:
            p_ng = 1
            break
        C[i] = 1
    else:
        a = A[i]
        w = 2
        one = []
        while a != 1:
            f = 1

            while a%w == 0:
                a//=w
                if f == 1 and C[w] == 1:
                    p_ng = 1
                    break
                f = 0
                one.append(w)
            w += 1
            if B[a] == 0:
                if C[a] == 1:
                    p_ng = 1
                    break
                one.append(a)
                break
            # print(a,w)
            if p_ng== 1:
                break
        for ii in one:
            C[ii] = 1
        if p_ng == 1:
            break


# ind = 0
# while ind < n and A[ind] == 1:
#     ind += 1

# if ind < n:
#     for j in range(ind, n):
#         # print(B[:10])
#         for i in range(1, (l-1) // A[j] + 1):
#             indj = i * A[j]
#             # print(indj)
#             if i == 1 and B[indj] == 1:
#                 p_ng = 1
#                 break
#             B[indj] = 1
#         if j > 0 and A[j-1] == A[j]:
#             p_ng = 1
#             break
#         if p_ng == 1:
#             break

if p_ng == 0:
    print("pairwise coprime")
    sys.exit()

from math import gcd
g = A[0]
for i in range(1, n):
    g = gcd(g, A[i])

if g == 1:
    print("setwise coprime")
else:
    print("not coprime")