stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
// E - Coprime

#include <bits/stdc++.h>

using namespace std;

#define rpd(i,s,e,d) for(int i=(s);i<(int)(e);i+=(d))



int sum_array(vector<int> &C, int start, int end, int step){

	int c = 0;

	rpd(i, start, end, step) c += C[i];

	return c;

}



int main(){

	cin.tie(0); ios::sync_with_stdio(false);

	

	int MAX_A = 1000000 + 1;

	int N; cin>>N;

	vector<int> C(MAX_A, 0);

	int g = 0;

	rpd(i, 0, N, 1){

		int a; cin>>a;

		C[a]++;

		g = gcd(g, a);

	}

	int t = 0;

	if(sum_array(C, 2, MAX_A, 2) > 1) t = 1;

	else

		rpd(i, 3, MAX_A, 2) if(sum_array(C, i, MAX_A, i) > 1){ t = 1; break; }

	if(t == 1 && g > 1) t = 2;

	cout<< vector<string>{"pairwise","setwise","not"}[t] <<" coprime\n";

}


// Faster C++ solution for the same problem (measured speedup: 5.6838169555850575x):
// E - Coprime

#include <bits/stdc++.h>

using namespace std;

using vi = vector<int>;

#define rpd(i,s,e,d) for(int i=(s);i<(int)(e);i+=(d))



vi gen_d_prim(int n){

	vi D(n+1, 0);

	rpd(i, 2, n+1, 1)

		if(!D[i]) rpd(j, i, n+1, i) D[j] = i;

	return D;

}



bool is_pairwise(vi &A){

	vi D = gen_d_prim(1000000);

	set<int> past;

	for(auto a:A){

		set<int> now;

		while(a != 1){

			// # 素数 D[a]: 今回は未済 & 過去は済

			if(!now.count(D[a]) && past.count(D[a])) return false;

			now.insert(D[a]);

			past.insert(D[a]);

			a /= D[a];

		}

	}

	return true;

}



int main(){

	cin.tie(0); ios::sync_with_stdio(false);



	int N; cin>>N;

	int g = 0;

	vi A(N); rpd(i, 0, N, 1){ cin>>A[i]; g = gcd(g, A[i]); }

	int t = 0;

	if(g > 1) t = 2;

	else t = !is_pairwise(A);

	cout<< vector<string>{"pairwise","setwise","not"}[t] <<" coprime\n";

}
// Slower C++ solution:
// E - Coprime

#include <bits/stdc++.h>

using namespace std;

#define rpd(i,s,e,d) for(int i=(s);i<(int)(e);i+=(d))



int sum_array(vector<int> &C, int start, int end, int step){

	int c = 0;

	rpd(i, start, end, step) c += C[i];

	return c;

}



int main(){

	cin.tie(0); ios::sync_with_stdio(false); // 232ms -> 90ms



	int MAX_A = 1000000 + 1;

	int N; cin>>N;

	vector<int> C(MAX_A, 0);

	int g = 0;

	rpd(i, 0, N, 1){

		int a; cin>>a;

		C[a]++;

		g = gcd(g, a);

	}

	int t = 0;

	if(g > 1) t = 2;

	else if(sum_array(C, 2, MAX_A, 2) > 1) t = 1;

	else

		rpd(i, 3, MAX_A, 2) if(sum_array(C, i, MAX_A, i) > 1){ t = 1; break; }

	cout<< vector<string>{"pairwise","setwise","not"}[t] <<" coprime\n";

}


// Faster C++ solution for the same problem (measured speedup: 5.029840793220426x):
// E - Coprime

#include <bits/stdc++.h>

using namespace std;

using vi = vector<int>;

#define rpd(i,s,e,d) for(int i=(s);i<(int)(e);i+=(d))



vi gen_d_prim(int n){

	vi D(n+1, 0);

	rpd(i, 2, n+1, 1)

		if(!D[i]) rpd(j, i, n+1, i) D[j] = i;

	return D;

}



bool is_pairwise(vi &A){

	vi D = gen_d_prim(1000000);

	set<int> past;

	for(auto a:A){

		set<int> now;

		while(a != 1){

			// # 素数 D[a]: 今回は未済 & 過去は済

			if(!now.count(D[a]) && past.count(D[a])) return false;

			now.insert(D[a]);

			past.insert(D[a]);

			a /= D[a];

		}

	}

	return true;

}



int main(){

	cin.tie(0); ios::sync_with_stdio(false);



	int N; cin>>N;

	int g = 0;

	vi A(N); rpd(i, 0, N, 1){ cin>>A[i]; g = gcd(g, A[i]); }

	int t = 0;

	if(g > 1) t = 2;

	else t = !is_pairwise(A);

	cout<< vector<string>{"pairwise","setwise","not"}[t] <<" coprime\n";

}
// Slower C++ solution:
// E - Coprime

#include <bits/stdc++.h>

using namespace std;

#define rpd(i,s,e,d) for(int i=(s);i<(int)(e);i+=(d))



int sum_array(vector<int> &C, int start, int end, int step){

	int c = 0;

	rpd(i, start, end, step) c += C[i];

	return c;

}



int main(){

	cin.tie(0); ios::sync_with_stdio(false); // 232ms -> 90ms



	int MAX_A = 1000000 + 1;

	int N; cin>>N;

	vector<int> C(MAX_A, 0);

	int g = 0;

	rpd(i, 0, N, 1){ int a; cin>>a; C[a]++; g = gcd(g, a); }

	int t = 0;

	if(g > 1) t = 2;

	else if(sum_array(C, 2, MAX_A, 2) > 1) t = 1;

	else rpd(i, 3, MAX_A, 2) if(sum_array(C, i, MAX_A, i) > 1){ t = 1; break; }

	cout<< vector<string>{"pairwise","setwise","not"}[t] <<" coprime\n";

}


// Faster C++ solution for the same problem (measured speedup: 5.029840793220426x):
// E - Coprime

#include <bits/stdc++.h>

using namespace std;

using vi = vector<int>;

#define rpd(i,s,e,d) for(int i=(s);i<(int)(e);i+=(d))



vi gen_d_prim(int n){

	vi D(n+1, 0);

	rpd(i, 2, n+1, 1)

		if(!D[i]) rpd(j, i, n+1, i) D[j] = i;

	return D;

}



bool is_pairwise(vi &A){

	vi D = gen_d_prim(1000000);

	set<int> past;

	for(auto a:A){

		set<int> now;

		while(a != 1){

			// # 素数 D[a]: 今回は未済 & 過去は済

			if(!now.count(D[a]) && past.count(D[a])) return false;

			now.insert(D[a]);

			past.insert(D[a]);

			a /= D[a];

		}

	}

	return true;

}



int main(){

	cin.tie(0); ios::sync_with_stdio(false);



	int N; cin>>N;

	int g = 0;

	vi A(N); rpd(i, 0, N, 1){ cin>>A[i]; g = gcd(g, A[i]); }

	int t = 0;

	if(g > 1) t = 2;

	else t = !is_pairwise(A);

	cout<< vector<string>{"pairwise","setwise","not"}[t] <<" coprime\n";

}
// Slower C++ solution:
// E - Coprime

#include <bits/stdc++.h>

using namespace std;

#define MAX_A 1'000'001

int N;

vector<int> A, C(MAX_A, 0);



// 素数と個数を求める

vector<pair<int,int>> factorize(int n){

  vector<pair<int,int>> res;

  for(int i=2; i*i<=n; ++i){

    if (n%i) continue;

    res.emplace_back(i,0);

    while(n%i == 0){

      n /= i;

      res.back().second++;

    }

  }

  if(n != 1) res.emplace_back(n,1);

  return res;

}



string solve(){

	for(int a:A)

		for(auto p:factorize(a)) C[p.first]++;

	int max_c = 0;

	for(auto c:C) max_c = max(max_c, c);

	if(max_c <= 1) return "pairwise";

	else if(max_c <= N-1) return "setwise";

	return "not";

}



int main(){

	cin>>N;

	A.resize(N); for(int i=0; i<N; ++i) cin>>A[i];

	cout<< solve() <<" coprime\n";

}


// Faster C++ solution for the same problem (measured speedup: 1.1305309557174785x):
// E - Coprime

#include <bits/stdc++.h>

using namespace std;

#define rpd(i,s,e,d) for(int i=(s);i<(int)(e);i+=(d))



int main(){

	cin.tie(0); ios::sync_with_stdio(false);



	int N; cin>>N;

	vector<int> C(1e6+1, 0);

	int g = 0;

	rpd(i, 0, N, 1){ int a; cin>>a; C[a]++; g = gcd(g, a); }



	auto not_pairwise = [&]{

		int c = 0;

		rpd(j, 2, C.size(), 2) c += C[j];

		if(c > 1) return true;

		rpd(i, 3, C.size(), 2){

			int c = 0;

			rpd(j, i, C.size(), i) c += C[j];

			if(c > 1) return true;

		}

		return false;

	};



	cout<< vector<string>{"pairwise","setwise","not"}[(g > 1) + not_pairwise()] <<" coprime\n";

}
// Slower C++ solution:
#include<stdio.h>

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

const int MAX=1e6;

static inline int IN(void)

{

  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}

  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;

}

static inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}

typedef struct{int SPF[1000001],Primes[168],sz;}Template;

Template P;

static inline void ready(void)

{

  *P.SPF=1,*P.Primes=2,P.sz=1;

  rep(i,MAX/2)P.SPF[2*(i+1)]=2,P.SPF[2*(i+1)-1]=2*(i+1)-1;

  rep(i,MAX/2-1)

  {

    int x=2*(i+1)+1;if(P.SPF[x]==x){P.Primes[P.sz++]=x;}if(x*x>MAX)break;

    rep(j,P.sz){if(P.Primes[j]<=P.SPF[x]&&x*P.Primes[j]<=MAX)P.SPF[x*P.Primes[j]]=P.Primes[j];else break;}

  }

}

const char common[]="not coprime",disjoint[]="pairwise coprime",several[]="setwise coprime";

int  vol=0,esc[1000000];

static inline int Divise(int x)

{

  if(!x){return 0;}

  rep(i,P.sz)

  {

    if(P.Primes[i]*P.Primes[i]>x)break;

    if(x%P.Primes[i]==0)

    {

      if(esc[P.Primes[i]-1])return 0;

      esc[P.Primes[i]-1]=1;

      while(x%P.Primes[i]==0&&x)x/=P.Primes[i];

    }

  }

  if(x>1){if(esc[x-1])return 0;esc[x-1]=1;}

  return 1;

}

int main(void)

{

  int N=IN(),A=0,flag=0,g=0;ready();

  rep(i,N){A=IN();g=GCD(g,A);if(i&&g!=1){flag=1;}if(!Divise(A)){flag=1;}}

  if(g>1)return puts(common),0;

  if(flag)return puts(several),0;else return puts(disjoint),0;

}

// Faster C++ solution for the same problem (measured speedup: 26.65818376474151x):
#include<stdio.h>

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

const int MAX=1e6;

static inline int IN(void)

{

  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}

  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;

}

static inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}

const int Primes[168]=

{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,

 97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,

 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,

 367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,

 509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,

 661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,

 829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};

const char common[]="not coprime",disjoint[]="pairwise coprime",several[]="setwise coprime";

char esc[1000000];

static inline int Divise(int x)

{

  if(!x){return 0;}

  rep(i,168)

  {

    if(Primes[i]*Primes[i]>x)break;

    if(x%Primes[i])continue;

    if(esc[Primes[i]-1])return 0;

    esc[Primes[i]-1]=1;

    while(x%Primes[i]==0&&x)x/=Primes[i];

  }

  if(x>1){if(esc[x-1])return 0;esc[x-1]=1;}

  return 1;

}

int main(void)

{

  int N=IN(),A=0,flag=0,g=0;

  rep(i,N){A=IN();g=GCD(g,A);if(i&&g!=1){flag=1;}if(!Divise(A)){flag=1;}}

  if(g>1)return puts(common),0;else{if(flag)return puts(several),0;else return puts(disjoint),0;}

}
// Slower C++ solution:
#include<stdio.h>

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

const int MAX=1e6;

static inline int IN(void)

{

  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}

  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;

}

static inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}

typedef struct{int SPF[1000001],Primes[168],sz;}Template;

Template P;

static inline void ready(void)

{

  *P.SPF=1,*P.Primes=2,P.sz=1;

  rep(i,MAX/2)P.SPF[2*(i+1)]=2,P.SPF[2*(i+1)-1]=2*(i+1)-1;

  rep(i,MAX/2-1)

  {

    int x=2*(i+1)+1;if(P.SPF[x]==x){P.Primes[P.sz++]=x;}if(x*x>MAX)break;

    rep(j,P.sz){if(P.Primes[j]<=P.SPF[x]&&x*P.Primes[j]<=MAX)P.SPF[x*P.Primes[j]]=P.Primes[j];else break;}

  }

}

const char common[]="not coprime",disjoint[]="pairwise coprime",several[]="setwise coprime";

char esc[1000000];

static inline int Divise(int x)

{

  if(!x){return 0;}

  rep(i,168)

  {

    if(P.Primes[i]*P.Primes[i]>x)break;

    if(x%P.Primes[i]==0)

    {

      if(esc[P.Primes[i]-1])return 0;

      esc[P.Primes[i]-1]=1;

      while(x%P.Primes[i]==0&&x)x/=P.Primes[i];

    }

  }

  if(x>1){if(esc[x-1])return 0;esc[x-1]=1;}

  return 1;

}

int main(void)

{

  int N=IN(),A=0,flag=0,g=0;ready();

  rep(i,N){A=IN();g=GCD(g,A);if(i&&g!=1){flag=1;}if(!Divise(A)){flag=1;}}

  if(g>1)return puts(common),0;

  if(flag)return puts(several),0;else return puts(disjoint),0;

}

// Faster C++ solution for the same problem (measured speedup: 26.66442501657246x):
#include<stdio.h>

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

const int MAX=1e6;

static inline int IN(void)

{

  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}

  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;

}

static inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}

const int Primes[168]=

{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,

 97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,

 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,

 367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,

 509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,

 661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,

 829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};

const char common[]="not coprime",disjoint[]="pairwise coprime",several[]="setwise coprime";

char esc[1000000];

static inline int Divise(int x)

{

  if(!x){return 0;}

  rep(i,168)

  {

    if(Primes[i]*Primes[i]>x)break;

    if(x%Primes[i])continue;

    if(esc[Primes[i]-1])return 0;

    esc[Primes[i]-1]=1;

    while(x%Primes[i]==0&&x)x/=Primes[i];

  }

  if(x>1){if(esc[x-1])return 0;esc[x-1]=1;}

  return 1;

}

int main(void)

{

  int N=IN(),A=0,flag=0,g=0;

  rep(i,N){A=IN();g=GCD(g,A);if(i&&g!=1){flag=1;}if(!Divise(A)){flag=1;}}

  if(g>1)return puts(common),0;else{if(flag)return puts(several),0;else return puts(disjoint),0;}

}
// Slower C++ solution:
#include<stdio.h>

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

const int MAX=1e6;

static inline int IN(void)

{

  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}

  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;

}

static inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}

typedef struct{int SPF[1000001],Primes[168],sz;}Template;

Template P;

static inline void ready(void)

{

  *P.SPF=1,*P.Primes=2,P.sz=1;

  rep(i,MAX/2)P.SPF[2*(i+1)]=2,P.SPF[2*(i+1)-1]=2*(i+1)-1;

  rep(i,MAX/2-1)

  {

    int x=2*(i+1)+1;if(P.SPF[x]==x){P.Primes[P.sz++]=x;}if(x*x>MAX)break;

    rep(j,P.sz){if(P.Primes[j]<=P.SPF[x]&&x*P.Primes[j]<=MAX)P.SPF[x*P.Primes[j]]=P.Primes[j];else break;}

  }

}

const char common[]="not coprime",disjoint[]="pairwise coprime",several[]="setwise coprime";

char esc[1000000];

static inline int Divise(int x)

{

  if(!x){return 0;}

  rep(i,168)

  {

    if(P.Primes[i]*P.Primes[i]>x)break;

    if(x%P.Primes[i])continue;

    if(esc[P.Primes[i]-1])return 0;

    esc[P.Primes[i]-1]=1;

    while(x%P.Primes[i]==0&&x)x/=P.Primes[i];

  }

  if(x>1){if(esc[x-1])return 0;esc[x-1]=1;}

  return 1;

}

int main(void)

{

  int N=IN(),A=0,flag=0,g=0;ready();

  rep(i,N){A=IN();g=GCD(g,A);if(i&&g!=1){flag=1;}if(!Divise(A)){flag=1;}}

  if(g>1)return puts(common),0;

  if(flag)return puts(several),0;else return puts(disjoint),0;

}

// Faster C++ solution for the same problem (measured speedup: 26.664447709326268x):
#include<stdio.h>

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

const int MAX=1e6;

static inline int IN(void)

{

  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}

  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;

}

static inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}

const int Primes[168]=

{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,

 97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,

 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,

 367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,

 509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,

 661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,

 829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};

const char common[]="not coprime",disjoint[]="pairwise coprime",several[]="setwise coprime";

char esc[1000000];

static inline int Divise(int x)

{

  if(!x){return 0;}

  rep(i,168)

  {

    if(Primes[i]*Primes[i]>x)break;

    if(x%Primes[i])continue;

    if(esc[Primes[i]-1])return 0;

    esc[Primes[i]-1]=1;

    while(x%Primes[i]==0&&x)x/=Primes[i];

  }

  if(x>1){if(esc[x-1])return 0;esc[x-1]=1;}

  return 1;

}

int main(void)

{

  int N=IN(),A=0,flag=0,g=0;

  rep(i,N){A=IN();g=GCD(g,A);if(i&&g!=1){flag=1;}if(!Divise(A)){flag=1;}}

  if(g>1)return puts(common),0;else{if(flag)return puts(several),0;else return puts(disjoint),0;}

}
// Slower C++ solution:
#include<stdio.h>

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

const int MAX=1e6;

static inline int IN(void)

{

  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}

  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;

}

static inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}

typedef struct{int SPF[1000001],Primes[168],sz;}Template;

Template P;

static inline void ready(void)

{

  *P.SPF=1,*P.Primes=2,P.sz=1;

  rep(i,MAX/2)P.SPF[2*(i+1)]=2,P.SPF[2*(i+1)-1]=2*(i+1)-1;

  rep(i,MAX/2-1)

  {

    int x=2*(i+1)+1;if(P.SPF[x]==x){P.Primes[P.sz++]=x;}if(x*x>MAX)break;

    rep(j,P.sz){if(P.Primes[j]<=P.SPF[x]&&x*P.Primes[j]<=MAX)P.SPF[x*P.Primes[j]]=P.Primes[j];else break;}

  }

}

const char common[]="not coprime",disjoint[]="pairwise coprime",several[]="setwise coprime";

int  vol=0,esc[1000000];

static inline int Divise(int x)

{

  if(!x){return 0;}

  rep(i,P.sz)

  {

    if(P.Primes[i]*P.Primes[i]>x)break;

    if(x%P.Primes[i]==0)

    {

      if(esc[P.Primes[i]-1])return 0;

      esc[P.Primes[i]-1]=1;

      while(x%P.Primes[i]==0&&x)x/=P.Primes[i];

    }

  }

  if(x>1){if(esc[x-1])return 0;esc[x-1]=1;}

  return 1;

}

int main(void)

{

  int N=IN(),A=0,flag=0,g=0;ready();

  rep(i,N){A=IN();g=GCD(g,A);if(i&&g!=1){flag=1;}if(!Divise(A)){flag=1;}}

  if(g>1)return puts(common),0;

  if(flag)return puts(several),0;else return puts(disjoint),0;

}

// Faster C++ solution for the same problem (measured speedup: 26.660175733530988x):
#include<stdio.h>

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

const int MAX=1e6;

static inline int IN(void)

{

  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}

  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;

}

static inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}

const int Primes[168]=

{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,

 97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,

 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,

 367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,

 509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,

 661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,

 829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};

const char common[]="not coprime",disjoint[]="pairwise coprime",several[]="setwise coprime";

char esc[1000000];

static inline int Divise(int x)

{

  if(!x){return 0;}

  rep(i,168)

  {

    if(Primes[i]*Primes[i]>x)break;

    if(x%Primes[i])continue;

    if(esc[Primes[i]-1])return 0;

    esc[Primes[i]-1]=1;

    while(x%Primes[i]==0&&x)x/=Primes[i];

  }

  if(x>1){if(esc[x-1])return 0;esc[x-1]=1;}

  return 1;

}

int main(void)

{

  int N=IN(),A=0,flag=0,g=0;

  rep(i,N){A=IN();g=GCD(g,A);if(i&&g!=1){flag=1;}if(flag)continue;else{if(!Divise(A))flag=1;}}

  if(g>1)return puts(common),0;else{if(flag)return puts(several),0;else return puts(disjoint),0;}

}
// Slower C++ solution:
#include<stdio.h>

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

const int MAX=1e6;

static inline int IN(void)

{

  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}

  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;

}

static inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}

typedef struct{int SPF[1000001],Primes[168],sz;}Template;

Template P;

static inline void ready(void)

{

  *P.SPF=1,*P.Primes=2,P.sz=1;

  rep(i,MAX/2)P.SPF[2*(i+1)]=2,P.SPF[2*(i+1)-1]=2*(i+1)-1;

  rep(i,MAX/2-1)

  {

    int x=2*(i+1)+1;if(P.SPF[x]==x){P.Primes[P.sz++]=x;}if(x*x>MAX)break;

    rep(j,P.sz){if(P.Primes[j]<=P.SPF[x]&&x*P.Primes[j]<=MAX)P.SPF[x*P.Primes[j]]=P.Primes[j];else break;}

  }

}

const char common[]="not coprime",disjoint[]="pairwise coprime",several[]="setwise coprime";

char esc[1000000];

static inline int Divise(int x)

{

  if(!x){return 0;}

  rep(i,168)

  {

    if(P.Primes[i]*P.Primes[i]>x)break;

    if(x%P.Primes[i]==0)

    {

      if(esc[P.Primes[i]-1])return 0;

      esc[P.Primes[i]-1]=1;

      while(x%P.Primes[i]==0&&x)x/=P.Primes[i];

    }

  }

  if(x>1){if(esc[x-1])return 0;esc[x-1]=1;}

  return 1;

}

int main(void)

{

  int N=IN(),A=0,flag=0,g=0;ready();

  rep(i,N){A=IN();g=GCD(g,A);if(i&&g!=1){flag=1;}if(!Divise(A)){flag=1;}}

  if(g>1)return puts(common),0;

  if(flag)return puts(several),0;else return puts(disjoint),0;

}

// Faster C++ solution for the same problem (measured speedup: 26.6664174517245x):
#include<stdio.h>

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

const int MAX=1e6;

static inline int IN(void)

{

  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}

  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;

}

static inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}

const int Primes[168]=

{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,

 97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,

 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,

 367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,

 509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,

 661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,

 829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};

const char common[]="not coprime",disjoint[]="pairwise coprime",several[]="setwise coprime";

char esc[1000000];

static inline int Divise(int x)

{

  if(!x){return 0;}

  rep(i,168)

  {

    if(Primes[i]*Primes[i]>x)break;

    if(x%Primes[i])continue;

    if(esc[Primes[i]-1])return 0;

    esc[Primes[i]-1]=1;

    while(x%Primes[i]==0&&x)x/=Primes[i];

  }

  if(x>1){if(esc[x-1])return 0;esc[x-1]=1;}

  return 1;

}

int main(void)

{

  int N=IN(),A=0,flag=0,g=0;

  rep(i,N){A=IN();g=GCD(g,A);if(i&&g!=1){flag=1;}if(flag)continue;else{if(!Divise(A))flag=1;}}

  if(g>1)return puts(common),0;else{if(flag)return puts(several),0;else return puts(disjoint),0;}

}