use proconio::input;
use std::collections::{HashMap, HashSet};

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }
    if is_pairwise(&a) {
        println!("pairwise coprime");
    } else if is_setwise(&a) {
        println!("setwise coprime");
    } else {
        println!("not coprime");
    }
}

/// O(n log(log(n))) # calculate vec, which vec[i] mean min(factorization(n))
fn min_primes(size: usize) -> Vec<usize> {
    let mut sieve: Vec<_> = (0..=size).collect();
    for i in 2.. {
        if i * i > size {
            break;
        }
        for j in 2..=(size / i) {
            if sieve[i * j] == i * j {
                sieve[i * j] = i;
            }
        }
    }
    sieve
}

/// O(log(n)) # calculate prime factorization of n, with min_primes
fn factorization(n: usize, min_primes: &[usize]) -> HashMap<usize, usize> {
    if n <= 1 {
        return vec![(n, 1)].into_iter().collect();
    }
    let (mut divided, mut facts) = (n, HashMap::new());
    while divided > 1 {
        *facts.entry(min_primes[divided]).or_insert(0) += 1;
        divided /= min_primes[divided];
    }
    facts
}

fn is_pairwise(a: &[usize]) -> bool {
    let &max = a.iter().max().unwrap();
    let min_primes = min_primes(max);
    let mut p = HashSet::new();
    for &ai in a.iter() {
        for (k, _) in factorization(ai, &min_primes) {
            if p.contains(&k) {
                return false;
            }
            p.insert(k);
        }
    }
    true
}

fn is_setwise(a: &Vec<usize>) -> bool {
    use num::integer::gcd;
    use num::Integer;

    /// O(|v| log(min(v))) # calculate gcd recursively
    fn gcd_recursive<T: Integer + Copy>(v: &Vec<T>) -> T {
        if v.len() == 0 {
            T::zero()
        } else if v.len() == 1 {
            v[0]
        } else {
            let mid = (v.len() + 1) / 2;
            gcd_recursive(
                &(0..mid)
                    .map(|i| {
                        if 2 * i < v.len() - 1 {
                            gcd(v[2 * i], v[2 * i + 1])
                        } else {
                            v[2 * i]
                        }
                    })
                    .collect(),
            )
        }
    }

    gcd_recursive(&a) == 1
}
