#include <bits/stdc++.h>
using namespace std;
std::mt19937_64 rng(
    std::chrono::steady_clock::now().time_since_epoch().count());
template <class T>
inline T rnd(T l, T r) {
  return std::uniform_int_distribution<T>(l, r)(rng);
}
const int N = 2000005, inf = 2e9;
int n, a[N], d[5], dd, o[N];
inline void gcd(const int a, const int b) {
  return !b ? dd = a, void() : gcd(b, a % b);
}
int main() {
  scanf("%d", &n);
  register int i, j, T = (n <= 1000 ? 8000 : 200);
  for (i = 1, dd = 0; i <= n; ++i) scanf("%d", &a[i]), gcd(a[i], dd);
  if (dd != 1) return puts("NO"), 0;
  while (T--) {
    d[0] = d[1] = 0;
    for (i = 1; i <= n; ++i) {
      j = rnd(0, inf) & 1, gcd(a[i], d[j]);
      if (dd == d[j]) j ^= 1, gcd(a[i], d[j]);
      d[j] = dd, o[i] = j;
    }
    if (d[0] == 1 && d[1] == 1) {
      puts("YES");
      for (i = 1; i <= n; ++i) printf("%d ", o[i] + 1);
      puts("");
      return 0;
    }
  }
  puts("NO");
  return 0;
}
