#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, num;
} w[101000];
int i, n, G[101000], chk[101000];
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  srand(time(nullptr));
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &w[i].x);
    w[i].num = i;
  }
  clock_t tt = clock();
  while (1) {
    random_shuffle(w + 1, w + n + 1);
    for (i = 1; i <= n; i++) {
      if (i == 1)
        G[i] = w[i].x;
      else
        G[i] = gcd(G[i - 1], w[i].x);
    }
    if (G[n] != 1) {
      puts("NO");
      return 0;
    }
    int g = 0;
    for (i = 1; i <= n; i++) {
      if (G[i] != G[i - 1])
        chk[w[i].num] = 1;
      else {
        g = gcd(g, w[i].x);
        chk[w[i].num] = 2;
      }
    }
    if (g == 1) {
      puts("YES");
      for (i = 1; i <= n; i++) printf("%d ", chk[i]);
      return 0;
    }
    clock_t z = clock() - tt;
    if ((double)z / CLOCKS_PER_SEC > 0.47) break;
  }
  puts("NO");
}
