#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, a[maxn], id[maxn], ans[maxn];
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    id[i] = i;
  }
  clock_t st = clock();
  while (clock() - st < 0.49 * CLOCKS_PER_SEC) {
    random_shuffle(id + 1, id + n + 1);
    int x = 0, y = 0;
    for (int i = 1; i <= n; i++) {
      int t = gcd(x, a[id[i]]);
      if (t == x) {
        y = gcd(y, a[id[i]]);
        ans[id[i]] = 2;
      } else {
        x = t;
        ans[id[i]] = 1;
      }
    }
    if (x == 1 && y == 1) {
      puts("YES");
      for (int i = 1; i <= n; i++) {
        if (i != 1) printf(" ");
        printf("%d", ans[i]);
      }
      return 0;
    }
  }
  puts("NO");
  return 0;
}
