#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
int n, a[N], st[N], tp = 0, s1[N], s2[N], ans[N], h[160][515][515];
bool f[160][515][515], g[160][515][515];
vector<int> fac(int n) {
  vector<int> ret;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) {
      ret.push_back(i);
      while (n % i == 0) n /= i;
    }
  if (n > 1) ret.push_back(n);
  return ret;
}
void print(int i, int j, int k) {
  if (!i) return;
  ans[st[i]] = (int)g[i][j][k] + 1;
  if (!g[i][j][k])
    print(i - 1, h[i][j][k], k);
  else
    print(i - 1, j, h[i][j][k]);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) a[i] = gi();
  for (int T = 1; T <= 5; T++) {
    memset(s1, 0, sizeof(s1));
    memset(s2, 0, sizeof(s2));
    int x = rand() % n + 1, y = rand() % n + 1;
    while (x == y) x = rand() % n + 1, y = rand() % n + 1;
    vector<int> A = fac(a[x]), B = fac(a[y]);
    tp = 0;
    int id1 = 0, id2 = 0;
    for (auto p : A) {
      int cnt = 0;
      for (int i = 1; i <= n; i++) {
        if (i == x || i == y) continue;
        if (a[i] % p != 0) {
          st[++tp] = i, s1[i] |= 1 << id1, ++cnt;
          if (cnt == 10) break;
        }
      }
      ++id1;
    }
    for (auto p : B) {
      int cnt = 0;
      for (int i = 1; i <= n; i++) {
        if (i == x || i == y) continue;
        if (a[i] % p != 0) {
          st[++tp] = i, s2[i] |= 1 << id2, ++cnt;
          if (cnt == 10) break;
        }
      }
      ++id2;
    }
    sort(st + 1, st + tp + 1);
    tp = unique(st + 1, st + tp + 1) - st - 1;
    memset(f, 0, sizeof(f));
    f[0][0][0] = 1;
    for (int i = 0; i < tp; i++)
      for (int j = 0; j < (1 << id1); j++)
        for (int k = 0; k < (1 << id2); k++) {
          if (!f[i][j][k]) continue;
          f[i + 1][j | s1[st[i + 1]]][k] = 1;
          g[i + 1][j | s1[st[i + 1]]][k] = 0;
          h[i + 1][j | s1[st[i + 1]]][k] = j;
          f[i + 1][j][k | s2[st[i + 1]]] = 1;
          g[i + 1][j][k | s2[st[i + 1]]] = 1;
          h[i + 1][j][k | s2[st[i + 1]]] = k;
        }
    if (f[tp][(1 << id1) - 1][(1 << id2) - 1]) {
      puts("YES");
      for (int i = 1; i <= n; i++) {
        if (i == y)
          ans[i] = 2;
        else
          ans[i] = 1;
      }
      print(tp, (1 << id1) - 1, (1 << id2) - 1);
      for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
      return 0;
    }
  }
  puts("NO");
  return 0;
}
