#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>
#include <random>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

random_device seed_gen;
mt19937 engine(seed_gen());
// 0, 1, 2 のどれかが得られる一様分布
// uniform_int_distribution<> dist(0, 2);
// cout << dist(engine) << endl;
// みたいに、先に確率分布を宣言して、そこにengineを与えて使う。

// =========ここまでテンプレ============

vector<ll> makeMinDivisers(ll n)
{
    vector<ll> mins(n + 1);
    rep(i, n + 1) mins[i] = i;
    for (ll i = 2; i * i <= n; ++i)
    {
        if (mins[i] % i == 0)
        {
            for (ll j = 0; i + j <= n; j += i)
            {
                if (mins[i + j] == i + j)
                    mins[i + j] = i;
            }
        }
    }
    return mins;
}

vector<pair<ll, ll>> primeFactorization(ll n, vector<ll> &minDivisers)
{
    if (n > minDivisers.size() - 1)
    {
        cout << "error! n must be <= minDivisers.size()-1" << endl;
    }
    else if (n <= 1)
    {
        cout << "error! n must be >= 2" << endl;
    }
    vector<pair<ll, ll>> result;
    ll x = n;
    ll lastDiviser = minDivisers[n];
    ll count = 0;
    while (x != 1)
    {
        if (minDivisers[x] == lastDiviser)
        {
            ++count;
            x = x / minDivisers[x];
        }
        else
        {
            result.push_back(pair<ll, ll>{lastDiviser, count});
            lastDiviser = minDivisers[x];
            count = 0;
        }
    }
    result.push_back(pair<ll, ll>{lastDiviser, count});
    return result;
}

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    bool isPairwiseCoprime = true;
    vector<ll> primeFlags(1000000, false);
    vector<ll> minDivisers = makeMinDivisers(1000000);
    rep(i, n)
    {
        if (isPairwiseCoprime == false)
        {
            break;
        }
        if (a[i] == 1)
            continue;
        vector<pair<ll, ll>> factorizations = primeFactorization(a[i], minDivisers);
        for (ll j = 0; j < factorizations.size(); ++j)
        {
            if (primeFlags[get<0>(factorizations[j])])
            {
                isPairwiseCoprime = false;
                break;
            }
            else
            {
                primeFlags[get<0>(factorizations[j])] = true;
            }
        }
    }
    if (isPairwiseCoprime)
    {
        cout << "pairwise coprime" << endl;
        return 0;
    }

    // setwiseを調べる
    ll greatestCD = a[0];
    rep(i, n - 1)
    {
        greatestCD = gcd(greatestCD, a[i + 1]);
    }
    if (greatestCD == 1)
    {
        cout << "setwise coprime" << endl;
    }
    else
    {
        cout << "not coprime" << endl;
    }
    return 0;
}

Measured memory_bytes: 26276