#include <bits/stdc++.h>
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
#pragma GCC optimize(2, 3, "Ofast")
using namespace std;
namespace MyMinMax {
template <typename T>
inline T mn(T x, T y) {
  return x < y ? x : y;
}
template <typename T>
inline T mx(T x, T y) {
  return x > y ? x : y;
}
template <typename T>
inline void chmin(T &x, T y) {
  (x > y) && (x = y);
}
template <typename T>
inline void chmax(T &x, T y) {
  (x < y) && (x = y);
}
}  // namespace MyMinMax
using namespace MyMinMax;
namespace IO {
char BB[1 << 18], *SS = BB, *TT = BB;
template <typename T>
inline void read(T &x) {
  x = 0;
  int fu = 1;
  char c =
      (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
           ? EOF
           : *SS++);
  while (c > 57 || c < 48) {
    if (c == 45) fu = -1;
    c = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
             ? EOF
             : *SS++);
  }
  while (c <= 57 && c >= 48) {
    x = x * 10 + c - 48;
    c = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
             ? EOF
             : *SS++);
  }
  x *= fu;
}
template <typename T>
inline void read(T *bg, T *ed) {
  while (bg != ed) read(*bg++);
}
inline void read(char &ch) {
  ch = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
            ? EOF
            : *SS++);
  while (ch <= 32)
    ch = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
              ? EOF
              : *SS++);
}
inline void read(char *s) {
  char ch =
      (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
           ? EOF
           : *SS++);
  while (ch <= 32)
    ch = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
              ? EOF
              : *SS++);
  while (ch > 32)
    *s++ = ch,
    ch = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
              ? EOF
              : *SS++);
  *s = '\0';
}
inline void sread(char *s) {
  char ch =
      (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
           ? EOF
           : *SS++);
  while (ch < 32)
    ch = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
              ? EOF
              : *SS++);
  while (ch >= 32)
    *s++ = ch,
    ch = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
              ? EOF
              : *SS++);
  *s = '\0';
}
inline void pread(char *&s) {
  char ch =
      (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
           ? EOF
           : *SS++);
  while (ch <= 32)
    ch = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
              ? EOF
              : *SS++);
  while (ch > 32)
    *s++ = ch,
    ch = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
              ? EOF
              : *SS++);
  *s = '\0';
}
inline void spread(char *&s) {
  char ch =
      (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
           ? EOF
           : *SS++);
  while (ch < 32)
    ch = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
              ? EOF
              : *SS++);
  while (ch >= 32)
    *s++ = ch,
    ch = (SS == TT && (TT = (SS = BB) + fread(BB, 1, 1 << 18, stdin), SS == TT)
              ? EOF
              : *SS++);
  *s = '\0';
}
template <typename T, typename... Args>
inline void read(T &x, Args &...args) {
  read(x);
  read(args...);
}
char out[1 << 18], *Out = out;
inline void putcha(char x) {
  *Out++ = x;
  if (Out - out >= (1 << 18)) fwrite(out, 1, Out - out, stdout), Out = out;
}
template <typename T>
inline void fprint(T x) {
  if (x < 0) putcha(45), x = -x;
  if (x > 9) fprint(x / 10);
  putcha(x % 10 + 48);
}
template <typename T>
inline void print(T x) {
  fprint(x);
  putcha(10);
}
inline void print(char *ch) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(10);
}
inline void put(char *ch) {
  while (*ch != '\0') putcha(*(ch++));
}
inline void print(const char *ch) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(10);
}
inline void put(const char *ch) {
  while (*ch != '\0') putcha(*(ch++));
}
template <typename T, typename... Args>
inline void print(T x, Args... args) {
  fprint(x);
  putcha(32);
  print(args...);
}
template <typename... Args>
inline void print(const char *ch, Args... args) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(32);
  print(args...);
}
template <typename... Args>
inline void print(char *ch, Args... args) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(32);
  print(args...);
}
template <typename T, typename... Args>
inline void printl(T x, Args... args) {
  fprint(x);
  putcha(10);
  print(args...);
}
template <typename... Args>
inline void printl(const char *ch, Args... args) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(10);
  print(args...);
}
template <typename... Args>
inline void printl(char *ch, Args... args) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(10);
  print(args...);
}
template <typename T>
inline void sprint(T x) {
  fprint(x);
  putcha(32);
}
template <typename T, typename... Args>
inline void sprint(T x, Args... args) {
  fprint(x);
  putcha(32);
  sprint(args...);
}
template <typename T>
inline void sprint(T *bg, T *ed) {
  while (bg != ed) sprint(*bg++);
}
template <typename T>
inline void print(T *bg, T *ed) {
  while (bg != ed) sprint(*bg++);
  putcha(10);
}
template <typename T>
inline void printl(T *bg, T *ed) {
  while (bg != ed) print(*bg++);
}
class AutoFlush {
 public:
  ~AutoFlush() { fwrite(out, 1, Out - out, stdout); }
} __AutoFlush;
}  // namespace IO
using namespace IO;
inline void swap(int &x, int &y) {
  int tmp = x;
  x = y;
  y = tmp;
}
namespace Orzlxl {
unsigned z3, z4, b;
inline unsigned rand_() {
  z3 = ((z3 & 4294967280U) << 7) ^ ((z3 << 13) ^ z3) >> 21;
  z4 = ((z4 & 4294967168U) << 13) ^ ((z4 << 3) ^ z4) >> 12;
  return (z3 ^ z4);
}
inline void srand_(unsigned x) {
  z3 = x ^ 0x1234598766U;
  z4 = (~x) + 51;
}
template <typename T>
inline void shuffle(T *bg, T *ed) {
  int len = ed - bg;
  for (int i = 1; i <= len - 1; ++i) swap(bg[i], bg[rand_() % i]);
}
}  // namespace Orzlxl
int a[100005], n, p[100005];
inline int gcd(int x, int y) { return !y ? x : gcd(y, x % y); }
inline int judge() {
  int ret = -1, num = 0;
  for (int i = 1; i <= n; ++i) {
    num = gcd(num, a[p[i]]);
    ret = i;
    if (num == 1) break;
  }
  if (ret == n) return -1;
  num = 0;
  for (int i = ret + 1; i <= n; ++i) {
    num = gcd(num, a[p[i]]);
    if (num == 1) return ret;
  }
  return -1;
}
int ans[100005];
int main() {
  Orzlxl ::srand_(20171302);
  read(n);
  read(a + 1, a + n + 1);
  int g = 0;
  for (int i = 1; i <= n; ++i) g = gcd(g, a[i]);
  if (g > 1) return puts("NO"), 0;
  for (int i = 1; i <= n; ++i) p[i] = i;
  while ((double)clock() / CLOCKS_PER_SEC <= 0.445) {
    Orzlxl ::shuffle(p + 1, p + n + 1);
    int res = judge();
    if (res == -1) continue;
    for (int i = 1; i <= res; ++i) ans[p[i]] = 1;
    for (int i = res + 1; i <= n; ++i) ans[p[i]] = 2;
    print("YES");
    print(ans + 1, ans + n + 1);
    return 0;
  }
  print("NO");
}
