#include<bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define forp(i,a,b) for (int i = (a); i <(b); i++)
#define forn(i,a,b) for (int i = (a); i >(b); i--)
#define mod 1000000007
#define multiple_testcases_t int t;cin>>t;while(t--){solve();}
#define single_testcase_t solve();
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

// <----- Actual solve() function to print output -----> //
int tc=1;
void solve()
{
   ll n,m,k=0,z=-1,ans=0;
   cin>>n;
   ll a[n];
   vector<int> v(1e6+7);
   forp(i,0,n)
   {
       cin>>a[i];
       if(i==0)
       k=a[i];
       else
       k=__gcd(k,a[i]); 
       v[a[i]]++;
   }
   
   int flag=1;
   for(int i=2;i<=1e6;i++)
   {
       int f=0;
           for(int j=2*i;j<=(1e6);j+=i)
           {
               if(v[j]>0)
               {
                   f+=v[j];
               }
               if(f>=2)
               {
                   flag=0;
                   break;
               }
           }
       if(flag==0)
       break;
   }
   
   if(flag==1)
   {
       cout<<"pairwise coprime";
   }
   else if(k==1)
   {
       cout<<"setwise coprime";
   }
   else
   cout<<"not coprime";

 //  cout<<"\n";      //if t>1 uncomment this
}

// MAIN function --------------------------------------------------------------------------//
int main()
{
    fast_io
//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);

  single_testcase_t
 // multiple_testcases_t
return 0;
}



