#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define INF 1000000000
#define pb push_back
#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define tr(c, i) for (typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c), x) != c.end())

#define MAXN 1000005 
  
// Stores smallest prime factor for every number 
int spf[MAXN]; 
  
// Hash to store prime factors count 
int hash1[MAXN] = { 0 }; 
  
// Function to calculate SPF (Smallest Prime Factor) 
// for every number till MAXN 
void sieve() 
{ 
    spf[1] = 1; 
    for (int i = 2; i < MAXN; i++) 
  
        // Marking smallest prime factor for every 
        // number to be itself 
        spf[i] = i; 
  
    // Separately marking spf for every even 
    // number as 2 
    for (int i = 4; i < MAXN; i += 2) 
        spf[i] = 2; 
  
    // Checking if i is prime 
    for (int i = 3; i * i < MAXN; i++) { 
  
        // Marking SPF for all numbers divisible by i 
        if (spf[i] == i) { 
            for (int j = i * i; j < MAXN; j += i) 
  
                // Marking spf[j] if it is not 
                // previously marked 
                if (spf[j] == j) 
                    spf[j] = i; 
        } 
    } 
} 
  
// Function to store the prime factors after dividing 
// by the smallest prime factor at every step 
void getFactorization(int x) 
{ 
    int temp; 
    while (x != 1) { 
        temp = spf[x]; 
        if (x % temp == 0) { 
  
            // Storing the count of 
            // prime factors in hash 
            hash1[spf[x]]++; 
            x = x / spf[x]; 
        } 
        while (x % temp == 0) 
            x = x / temp; 
    } 
} 
  
// Function that returns true if there are 
// no common prime factors between x 
// and other numbers of the array 
bool check(int x) 
{ 
    int temp; 
    while (x != 1) { 
        temp = spf[x]; 
  
        // Checking whether it common 
        // prime factor with other numbers 
        if (x % temp == 0 && hash1[temp] > 1) 
            return false; 
        while (x % temp == 0) 
            x = x / temp; 
    } 
    return true; 
} 
  
// Function that returns true if there is 
// an element in the array which is coprime 
// with all the other elements of the array 
int hmm(int arr[], int n) 
{ 
  
    // Using sieve for generating prime factors 
    sieve(); 
  
    for (int i = 0; i < n; i++) 
        getFactorization(arr[i]); 
  
    // Checking the common prime factors 
    // with other numbers 
    int im = 1;
    int c = 0;
    for (int i = 0; i < n; i++) {
        if (check(arr[i])){
            im = 0;
            c++; 
        }
    }
  
    
    if(c==n) return 1;
    return 0;
} 


int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
int findGCD(int arr[], int n) 
{ 
    int result = arr[0]; 
    for (int i = 1; i < n; i++) 
    { 
        result = gcd(arr[i], result); 
  
        if(result == 1) 
        { 
           return 1; 
        } 
    } 
    return result; 
} 


int main() 
{ 
    int n,i,r,ara[2000005];
    cin>>n;
    for(i=0;i<n;i++){
        cin>>ara[i];
    } 
  
    r =  hmm(ara, n); 

    
    if(r==1) cout<<"pairwise coprime"<<endl;
    else if(findGCD(ara,n)==1) cout<<"setwise coprime"<<endl;
    else cout<<"not coprime"<<endl;
        
    return 0; 
} 

Measured memory_bytes: 15360