#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vpii = vector<pii>;
const int MAXK = 22;
const int MAXN = 100500;
const int MAX_MASK = 512;
vpii a;
int n, m;
int num[MAXK * MAXK][3];
int backet1[MAXK];
int backet2[MAXK];
int ans[MAXN];
int was[MAX_MASK][MAX_MASK];
int f1[MAX_MASK][MAX_MASK];
int f2[MAX_MASK][MAX_MASK];
pii f3[MAX_MASK][MAX_MASK];
vi factor(int x) {
  vi a;
  if (x % 2 == 0) {
    while (x % 2 == 0) x /= 2;
    a.emplace_back(2);
  }
  int t = 3;
  while (t * t <= x) {
    if (x % t == 0) {
      while (x % t == 0) x /= t;
      a.emplace_back(t);
    }
    t += 2;
  }
  if (x > 1) {
    a.emplace_back(x);
  }
  return a;
}
void rec(int m1, int m2) {
  if (m1 == 0 && m2 == 0) return;
  rec(f1[m1][m2], f2[m1][m2]);
  ans[f3[m1][m2].first] = f3[m1][m2].second;
}
void dv(vi v) {
  for (int x : v) cout << x << " ";
  cout << endl;
}
int solve() {
  auto v1 = factor(a[0].first);
  auto v2 = factor(a[1].first);
  int k1 = v1.size();
  int k2 = v2.size();
  int limit = k1 + k2;
  m = 0;
  for (int i = 0; i < limit; ++i) {
    backet1[i] = 0;
    backet2[i] = 0;
  }
  for (int i = 2; i < n; ++i) {
    int x = a[i].first;
    int m1 = 0;
    int m2 = 0;
    for (int j = 0; j < k1; ++j)
      if (x % v1[j]) {
        m1 = m1 | (1 << j);
      }
    for (int j = 0; j < k2; ++j)
      if (x % v2[j]) {
        m2 = m2 | (1 << j);
      }
    if (m1) {
      for (int j = 0; j < k1; ++j)
        if (((m1 >> j) & 1) && backet1[j] < limit) {
          backet1[j]++;
          num[m][0] = m1;
          num[m][1] = m2;
          num[m][2] = a[i].second;
          m++;
          m2 = 0;
          break;
        }
    }
    if (m2) {
      for (int j = 0; j < k2; ++j)
        if (((m2 >> j) & 1) && backet2[j] < limit) {
          backet2[j]++;
          num[m][0] = m1;
          num[m][1] = m2;
          num[m][2] = a[i].second;
          m++;
          break;
        }
    }
  }
  int M1 = (1 << k1) - 1;
  int M2 = (1 << k2) - 1;
  for (int i = 0; i <= M1; ++i)
    for (int j = 0; j <= M2; ++j) {
      was[i][j] = 0;
    }
  was[0][0] = 1;
  for (int z = 0; z < m; ++z) {
    int m1 = num[z][0];
    int m2 = num[z][1];
    int mz = num[z][2];
    for (int i = M1; i >= 0; --i)
      for (int j = M2; j >= 0; --j) {
        if (!was[i][j]) continue;
        int q;
        q = i | m1;
        if (!was[q][j]) {
          was[q][j] = 1;
          f1[q][j] = i;
          f2[q][j] = j;
          f3[q][j] = {mz, 1};
        }
        q = j | m2;
        if (!was[i][q]) {
          was[i][q] = 1;
          f1[i][q] = i;
          f2[i][q] = j;
          f3[i][q] = {mz, 2};
        }
      }
  }
  if (was[M1][M2]) {
    ans[a[0].second] = 1;
    ans[a[1].second] = 2;
    rec(M1, M2);
    for (int i = 1; i <= n; ++i)
      if (!ans[i]) ans[i] = 1;
    cout << "YES\n";
    for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
    cout << "\n";
    exit(0);
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    a.emplace_back(x, i + 1);
  }
  auto v1 = factor(a[0].first);
  for (int i = 1; i <= v1.size() + 1 && i < n; ++i) {
    swap(a[1], a[i]);
    solve();
    swap(a[1], a[i]);
  }
  cout << "NO\n";
}
