#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int p[100010];
int a[100010];
int res[100010];
const int M = 5000000;
int main() {
  srand(time(0));
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    p[i] = i;
  }
  long long s = clock();
  while (clock() - s < CLOCKS_PER_SEC * 0.45) {
    random_shuffle(p + 1, p + n + 1);
    int x = 0, y = 0;
    for (int i = 1; i <= n; i++) {
      int t = gcd(x, a[p[i]]);
      if (t != x) {
        x = t;
        res[p[i]] = 1;
      } else {
        res[p[i]] = 2;
        y = gcd(y, a[p[i]]);
      }
    }
    if (x == 1 && y == 1) {
      printf("YES\n");
      for (int i = 1; i <= n; i++) printf("%d ", res[i]);
      printf("\n");
      return 0;
    }
  }
  printf("NO\n");
  return 0;
}
