#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    int r = scanf("%d", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    int r = scanf("%lld", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, double i)
{
    printf("%.20f", i);
    return my;
}

constexpr char BR = '\n';


///////////////////////////////////////////////////

#include <unordered_map>
#include <vector>
#include <cmath>

class Factoriser
{
    std::vector<int> factors;

public:
    using map_type = std::unordered_map<int, int>;
    
    Factoriser(int N)
    {
        factors.resize(N+1, 0);
        int sqrN = static_cast<int>(std::sqrt(N));

        for (int i = 2; i <= sqrN; ++i)
        {
            if (factors[i] == 0)
            {
                for (int j = i * 2; j <= N; j += i)
                {
                    if (factors[j] == 0)
                    {
                        factors[j] = i;
                    }
                }
            }
        }
    }

    vector<int> prime_list() const
    {
        vector<int> P;
        for (int i = 0; i < factors.size(); i++)
        {
            if (factors[i] == i)
                P.push_back(i);
        }
        return P;
    }

    map_type Factorise(int M) const
    {
        map_type P;
        int mm = M;

        while (factors[mm])
        {
            ++P[factors[mm]];
            mm /= factors[mm];
        }

        if (mm >= 2) ++P[mm];
        return P;
    }
    
    bool IsPrime(int M) const
    {
        return factors[M] == 0;
    }
};

template<template <class ...> class MapT, class IntT>
MapT<IntT, int> factorise(IntT M)
{
    MapT<IntT, int> P;
    IntT mm = M;

    IntT sqrM = static_cast<IntT>(std::sqrt(M));
    IntT i = 2;
    while (i <= sqrM)
    {
        if (mm % i == 0)
        {
            ++P[i];
            mm /= i;
        }
        else
        {
            ++i;
        }
    }

    if (mm >= 2) ++P[mm];
    return P;
}

template<class IntT>
std::unordered_map<IntT, int> factorise_umap(IntT M)
{
    return factorise<std::unordered_map, IntT>(M);
}


bool is_pairwizse_coprime(const vector<Factoriser::map_type> &prime_maps)
{
    unordered_map<int,int> count;
    for (auto &&pm : prime_maps)
    {
        for (auto [p, i] : pm)
        {
            if (count.count(p))
            {
                return false;
            }
            else
            {
                count[p] = i;
            }
        }
    }
    return true;
}

int main()
{
    int N;
    io >> N;
    vi A(N);
    for (int i = 0; i < N; i++)
        io >> A[i];

    Factoriser fac(1'000'000);
    vector<Factoriser::map_type> prime_maps(N);
    for (int i = 0; i < N; i++)
    {
        prime_maps[i] = fac.Factorise(A[i]);
    }

    bool ans_pairwise = is_pairwizse_coprime(prime_maps);
    
    int ggcd = gcd(A[0], A[1]);
    for (int a: A)
        ggcd = gcd(ggcd, a);
    
    bool ans_setwise = (ggcd == 1);

    if (ans_pairwise)
    {
        io << "pairwise coprime" << BR;
    }
    else if (ans_setwise)
    {
        io << "setwise coprime" << BR;
    }
    else
    {
        io << "not coprime" << BR;
    }
    
}

Measured memory_bytes: 277848