#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
/*
 execution in cmd of windows: g++ p1.cpp -op1
  
  
  p1
 
 */
typedef double dd;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define nl <<"\n"
#define con continue
#define br break
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
ll mx=INT_MAX;
ll mi=INT_MIN;
#define mem0(a)         memset(a,0,sizeof(a))
#define mem1(a)         memset(a,-1,sizeof(a))
#define all(v) v.begin(), v.end()
#define fsort(v) sort(all(v))  
#define rsort(v) sort(v.rbegin(),v.rend())
#define rev(v) reverse(all(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define sumv(v,x) accumulate(v.begin(),v.end(),x);
const ll mod = 1000000007;
const ll inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
#define io { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define cs ll t;cin>>t;while(t--)
#define cs1 ll t;t=1;while(t--)

int main()
{
   #ifndef ONLINE_JUDGE
        ifstream cin("in.in");
        ofstream cout("out.out");
    #endif
    
        io;
        //////////////////////////////////
        cs1{
             ll i,j,k,l,s=0,p=INT_MAX,n,m,q=0,e;
             cin>>n;
             vector<ll> v(n);
             map<ll,ll> mp;
             for(i=0;i<n;i++){
                cin>>v[i];
                ll a=v[i];
                if(v[i]==1) q=1;
                for(j=2;j*j<=a;j++){
                    if(a%j==0){
                        ll y=a/j;
                        mp[j]++;
                       // cout<<j<<" ";
                        while(a%j==0) a=a/j;
                        ll x=a;
                        if(a%y==0){
                            mp[y]++;
                            while(a%y==0) a=a/(y);
                        }
                    }
                }
             //   cout nl;
            }
                ll a=0,b=0,c=0;
                for(i=2;i<mp.size();i++){
                    if(mp[i]==n) {c=1;}
                    if(mp[i]>=2) b=1;
                }

                if( (c==0 && b==1) || q==1) cout<<"setwise coprime" nl;
                else if(b==1) cout<<"pairwise coprime"  nl;
                else cout<<"not coprime" nl;
             
             
        }
        //////////////////////////////////
        cer;
}