We have N integers. The i-th number is A_i.

\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\leq i < j \leq N.

\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\ldots,A_N)=1.

Determine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.

Here, GCD(\ldots) denotes greatest common divisor.

Constraints

* 2 \leq N \leq 10^6
* 1 \leq A_i\leq 10^6

Input

Input is given from Standard Input in the following format:


N
A_1 \ldots A_N


Output

If \\{A_i\\} is pairwise coprime, print `pairwise coprime`; if \\{A_i\\} is setwise coprime, print `setwise coprime`; if neither, print `not coprime`.

Examples

Input

3
3 4 5


Output

pairwise coprime


Input

3
6 10 15


Output

setwise coprime


Input

3
6 10 16


Output

not coprime
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {
    int[] smallestDivisorOf;

    public static void main(String[] args) throws IOException {
        new Main().solve();
    }

    private void solve() throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        int n = Integer.parseInt(f.readLine());
        int[] ar = new int[n];
        StringTokenizer tokenizer = new StringTokenizer(f.readLine());
        for (int i = 0; i < n; i++) {
            ar[i] = Integer.parseInt(tokenizer.nextToken());
        }

        smallestDivisorOf = new int[1000001];
        for (int i = 2; i < smallestDivisorOf.length; i++) {
            for (int j = i; j < smallestDivisorOf.length; j += i) {
                if (smallestDivisorOf[j] == 0) {
                    smallestDivisorOf[j] = i;
                }
            }
        }

        if (isPairwise(ar)) {
            out.println("pairwise coprime");
        } else if (isSetwise(ar)) {
            out.println("setwise coprime");
        } else {
            out.println("not coprime");
        }

        out.close();
    }

    private boolean isPairwise(int[] ar) {
        ar = Arrays.copyOf(ar, ar.length);
        HashSet<Integer> primes = new HashSet<Integer>();
        while (ar[0] != 1) {
            primes.add(smallestDivisorOf[ar[0]]);
            ar[0] /= smallestDivisorOf[ar[0]];
        }

        for (int i =  1; i < ar.length; i++) {
            HashSet<Integer> currentPrimes = new HashSet<Integer>();
            while (ar[i] != 1) {
                currentPrimes.add(smallestDivisorOf[ar[i]]);
                ar[i] /= smallestDivisorOf[ar[i]];
            }

            for (int j : currentPrimes) {
                if (primes.contains(j)) return false;
                primes.add(j);
            }
        }

        return true;
    }

    private boolean isSetwise(int[] ar) {
        int gcd = ar[0];
        for (int i = 1; i < ar.length; i++) {
            gcd = gcd(gcd, ar[i]);
        }

        return gcd == 1;
    }

    private int gcd(int a, int b) {
        if (a % b == 0) {
            return b;
        }
        return gcd(b, a % b);
    }
}