#include <bits/stdc++.h>
using namespace std;
int n;
struct data {
  int v, id;
} a[100100];
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int bel[100100];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i].v), a[i].id = i;
  int tot = 100;
  int g1, g2;
  while (tot--) {
    random_shuffle(a + 1, a + n + 1);
    g1 = a[1].v, g2 = 0;
    bel[a[1].id] = 1;
    for (int i = 2; i <= n; ++i)
      if (gcd(g1, a[i].v) < g1) {
        g1 = gcd(g1, a[i].v);
        bel[a[i].id] = 1;
      } else {
        g2 = gcd(g2, a[i].v);
        bel[a[i].id] = 2;
      }
    if (g1 == 1 && g2 == 1) {
      puts("YES");
      for (int i = 1; i <= n; ++i) printf("%d ", bel[i]);
      puts("");
      return 0;
    }
  }
  puts("NO");
  return 0;
}
