program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32)::n,i,j,ap1,ap2
    integer(int32), allocatable:: a(:)
    logical:: is_pairwise_coprime, is_setwise_coprime
    logical,allocatable:: emerged(:)

    ! input -------------------------------------------------------------------
    read*, n
    allocate(a(n))
    read*, a(:)
    allocate(emerged(maxval(a)), source=.false.)

    ! Determine if it is pairwise coprime -------------------------------------
    is_pairwise_coprime = .true.
    do i=1,n
        j=1
        do while(j*j <= a(i))
            if (mod(a(i),j) == 0) then
                ap1 = a(i)/j
                ap2 = j
                if (emerged(ap1) .and. ap1 > 1) is_pairwise_coprime = .false.
                if (emerged(ap2) .and. ap2 > 1) is_pairwise_coprime = .false.
                emerged(ap1) = .true.
                emerged(ap2) = .true.
            end if
            if (.not. is_pairwise_coprime) exit ! pruning
            j=j+1
        end do
        if (.not. is_pairwise_coprime) exit ! pruning
    end do


    ! Determine if it is a setwise coprime --------------------------------------
    ap1 = a(1)
    do i=2,n
        ap1 = gcd(ap1,a(i))
    end do
    is_setwise_coprime = ap1 == 1

    ! output
    if (is_pairwise_coprime) then
        print'(a)', "pairwise coprime"
    else if (is_setwise_coprime) then
        print'(a)', "setwise coprime"
    else
        print'(a)', "not coprime"
    end if
contains
    function lcm(ap1,ap2) result(ret)
        integer(int32):: ap1,ap2,ret
        ret=ap1*ap2/gcd(ap1,ap2)
    end function
    recursive function gcd(ap1,ap2) result(ret)
        integer(int32):: ap1,ap2,ret
    
        if (mod(ap1,ap2) == 0) then
            ret = ap2
            return
        end if
    
        ret = gcd(ap2,mod(ap1,ap2))
    end function
end program main