#include <bits/stdc++.h>
using namespace std;
using std::cin;
using std::cout;
using std::endl;
namespace IN {
const int Max_Input_Number = 1000000;
char buf[Max_Input_Number], *p1, *p2;
template <typename T>
inline int input(T &x) {
  static std::streambuf *inbuf = cin.rdbuf();
  x = 0;
  register int f = 0, flag = 1;
  register char ch =
      (p1 == p2 &&
               (p2 = (p1 = buf) + inbuf->sgetn(buf, Max_Input_Number), p1 == p2)
           ? EOF
           : *p1++);
  if (ch == EOF) return EOF;
  while (!std::isdigit(ch)) {
    if (ch == '-') f = 1;
    ch = (p1 == p2 && (p2 = (p1 = buf) + inbuf->sgetn(buf, Max_Input_Number),
                       p1 == p2)
              ? EOF
              : *p1++);
  }
  if (std::isdigit(ch))
    x = x * 10 + (ch & 15),
    ch = (p1 == p2 && (p2 = (p1 = buf) + inbuf->sgetn(buf, Max_Input_Number),
                       p1 == p2)
              ? EOF
              : *p1++),
    flag = true;
  while (std::isdigit(ch)) {
    x = x * 10 + (ch & 15);
    ch = (p1 == p2 && (p2 = (p1 = buf) + inbuf->sgetn(buf, Max_Input_Number),
                       p1 == p2)
              ? EOF
              : *p1++);
  }
  x = f ? -x : x;
  return ch == EOF ? EOF : flag;
}
template <typename T, typename... Args>
inline int input(T &a, Args &...args) {
  return input(a) && input(args...);
}
inline int readc(char &ch) {
  static std::streambuf *inbuf = cin.rdbuf();
  return (ch = (p1 == p2 &&
                        (p2 = (p1 = buf) + inbuf->sgetn(buf, Max_Input_Number),
                         p1 == p2)
                    ? EOF
                    : *p1++)) == EOF
             ? EOF
             : 0;
}
inline int readst(char *st) {
  if (readc(*st) != EOF && (*st))
    while (readc(*(++st)) != EOF && *st != '\n')
      ;
  else
    return EOF;
  return 0;
}
}  // namespace IN
namespace OUT {
template <typename T>
inline void output(T x) {
  static std::streambuf *outbuf = cout.rdbuf();
  static char stack[21];
  static int top = 0;
  if (x < 0) {
    outbuf->sputc('-');
    x = -x;
  }
  if (!x) {
    outbuf->sputc('0');
    outbuf->sputc('\n');
    return;
  }
  while (x) {
    stack[++top] = x % 10 + '0';
    x /= 10;
  }
  while (top) {
    outbuf->sputc(stack[top]);
    --top;
  }
  outbuf->sputc('\n');
}
inline void putc(const char ch) {
  static std::streambuf *outbuf = cout.rdbuf();
  outbuf->sputc(ch);
}
template <typename T>
inline void output(const char ch, T x) {
  static std::streambuf *outbuf = cout.rdbuf();
  static char stack[21];
  static int top = 0;
  if (x < 0) {
    outbuf->sputc('-');
    x = -x;
  }
  if (!x) {
    outbuf->sputc('0');
    outbuf->sputc(ch);
    return;
  }
  while (x) {
    stack[++top] = x % 10 + '0';
    x /= 10;
  }
  while (top) {
    outbuf->sputc(stack[top]);
    --top;
  }
  outbuf->sputc(ch);
}
template <typename T, typename... Args>
inline void output(T a, Args... args) {
  output(a);
  output(args...);
}
template <typename T, typename... Args>
inline void output(const char ch, T a, Args... args) {
  output(ch, a);
  output(ch, args...);
}
inline void putst(const char *st) {
  static std::streambuf *outbuf = cout.rdbuf();
  int _len = strlen(st);
  const char *p = st;
  do {
    outbuf->sputc(*st);
    st++;
  } while (st + 1 < p + _len);
}
}  // namespace OUT
using IN::input;
using IN::readc;
using IN::readst;
using OUT::output;
using OUT::putc;
using OUT::putst;
const int N = 100010;
int a[N], p[N], ans[N];
int gcd(int a, int b) {
  int r = a % b;
  while (r) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(19260817);
  int n;
  input(n);
  for (int i = 1; i <= n; ++i) input(a[i]);
  for (int i = 1; i <= n; ++i) p[i] = i;
  int t = 100;
  while (t--) {
    random_shuffle(p + 1, p + 1 + n);
    int x = 0, y = 0, cnt;
    for (int i = 1; i <= n; ++i) {
      if ((x != 1) && ((cnt = gcd(x, a[p[i]])) != x))
        x = cnt, ans[p[i]] = 1;
      else
        y = gcd(y, a[p[i]]), ans[p[i]] = 2;
    }
    if (x == 1 && y == 1) {
      putst("YES\n");
      putc('\n');
      for (int i = 1; i <= n; ++i) output(' ', ans[i]);
      return 0;
    }
  }
  putst("NO\n");
  return 0;
}
