Problem: You are given an array of n integers. You need to split all integers into two groups so that the GCD of all integers in the first group is equal to one and the GCD of all integers in the second group is equal to one.

The GCD of a group of integers is the largest non-negative integer that divides all the integers in the group.

Both groups have to be non-empty.

Input

The first line contains a single integer n (2 ≤ n ≤ 10^5).

The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9) — the elements of the array.

Output

In the first line print "YES" (without quotes), if it is possible to split the integers into two groups as required, and "NO" (without quotes) otherwise.

If it is possible to split the integers, in the second line print n integers, where the i-th integer is equal to 1 if the integer a_i should be in the first group, and 2 otherwise.

If there are multiple solutions, print any.

Examples

Input


4
2 3 6 7


Output


YES
2 2 1 1 


Input


5
6 15 35 77 22


Output


YES
2 1 2 1 1 


Input


5
6 10 15 1000 75


Output


NO

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e6 + 5;
const double delta = 1e-8;
const long long mod = 998244353;
const int magic_const = 1e9;
mt19937 gen(54323244234);
long long get_rand(long long x) { return (gen() % x + x) % x; }
struct ev {
  double coord;
  int type;
  int mincost;
};
const bool operator<(const ev& f, const ev& s) { return f.coord < s.coord; }
void init() {}
class fenwick {
  vector<int> sums;

 public:
  fenwick(int n) { sums.resize(n + 3); }
  void add(int pos, int delta) {
    for (pos++; pos < sums.size(); pos += pos & (-pos)) sums[pos] += delta;
  }
  int size() { return sums.size() - 2; }
  int pref_sum(int pos) {
    if (pos < -1) return 0;
    int answer = 0;
    for (pos++; pos > 0; pos -= pos & (-pos)) answer += sums[pos];
    return answer;
  }
  int get_sum(int left, int right) {
    return pref_sum(right) - pref_sum(left - 1);
  }
};
const bool cmppp(const pair<int, int>& f, const pair<int, int>& s) {
  return (f.second == s.second) ? (f.first < s.first) : (f.second > s.second);
}
vector<int> unique_xs;
void add_to_compression(int x) { unique_xs.push_back(x); }
void compress() {
  sort(unique_xs.begin(), unique_xs.end());
  unique_xs = vector<int>(unique_xs.begin(),
                          unique(unique_xs.begin(), unique_xs.end()));
}
int get_num(int dt) {
  return lower_bound(unique_xs.begin(), unique_xs.end(), dt) -
         unique_xs.begin();
}
class dsu {
 public:
  vector<int> a;
  vector<int> sizes;
  dsu(int n) : a(n), sizes(n, 1) {
    for (int i = 0; i < n; i++) a[i] = i;
  }
  int get_parent(int x) { return (a[x] == x) ? x : (a[x] = get_parent(a[x])); }
  void unite(int l, int r) {
    int par_1 = get_parent(l);
    int par_2 = get_parent(r);
    if (par_1 == par_2) return;
    if (sizes[par_1] < sizes[par_2]) swap(par_1, par_2);
    sizes[par_1] += sizes[par_2];
    sizes[par_2] = 0;
    a[par_2] = par_1;
  }
};
vector<int> ans_t;
bool is_prime(int number) {
  for (int i = 2; i * i <= number; i++) {
    if (number % i == 0) {
      return false;
    }
  }
  return true;
}
int get_size(int x) {
  for (int i = 0; i < 32; i++) {
    if ((1 << i) >= x) return i;
  }
}
int n;
vector<int> a;
vector<int> answer;
vector<int> get_prime_divisors(int x) {
  vector<int> answer;
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      while (x % i == 0) x /= i;
      answer.push_back(i);
    }
  }
  if (x != 1) answer.push_back(x);
  return answer;
}
pair<int, int> get_2_mins(int divisor, int x1, int x2) {
  int f1 = magic_const + 1, f2 = magic_const + 2;
  int idx1 = -1, idx2 = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] % divisor != 0 && i != x1 && i != x2) {
      if (a[i] < f1) {
        f2 = f1;
        idx2 = idx1;
        f1 = a[i];
        idx1 = i;
      } else {
        if (a[i] < f2) {
          f2 = a[i];
          idx2 = i;
        }
      }
    }
  }
  return {idx1, idx2};
}
int get_mask(int x, vector<int>& divisors) {
  int result = 0;
  for (int i = 0; i < divisors.size(); i++) {
    if (x % divisors[i] == 0) result |= (1 << i);
  }
  return result;
}
int gcd(int x1, int x2) { return x2 == 0 ? x1 : gcd(x2, x1 % x2); }
bool stupid() {
  int max_t = 1 << n;
  max_t--;
  for (int i = 1; i < max_t; i++) {
    int gcd1 = -1, gcd2 = -1;
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) {
        if (gcd1 == -1)
          gcd1 = a[j];
        else
          gcd1 = gcd(gcd1, a[j]);
      } else {
        if (gcd2 == -1)
          gcd2 = a[j];
        else
          gcd2 = gcd(gcd2, a[j]);
      }
    }
    if (gcd1 == 1 && gcd2 == 1) {
      for (int j = 0; j < n; j++) {
        answer[j] = min(1, i & (1 << j));
      }
      return true;
    }
  }
  return false;
}
bool get_answer(int x1, int x2) {
  vector<int> a1 = get_prime_divisors(a[x1]);
  vector<int> a2 = get_prime_divisors(a[x2]);
  vector<int> un_div = a1;
  un_div.insert(un_div.end(), a2.begin(), a2.end());
  sort(un_div.begin(), un_div.end());
  un_div = vector<int>(un_div.begin(), unique(un_div.begin(), un_div.end()));
  vector<int> best_t;
  for (int i : un_div) {
    auto p_t = get_2_mins(i, x1, x2);
    if (p_t.first != -1) best_t.push_back(p_t.first);
    if (p_t.second != -1) best_t.push_back(p_t.second);
  }
  sort(best_t.begin(), best_t.end());
  best_t = vector<int>(best_t.begin(), unique(best_t.begin(), best_t.end()));
  int a1_size = 1 << a1.size();
  int a2_size = 1 << a2.size();
  vector<vector<vector<bool>>> dp(
      a1_size,
      vector<vector<bool>>(a2_size, vector<bool>(best_t.size() + 1, false)));
  dp[a1_size - 1][a2_size - 1][0] = true;
  for (int layer = 0; layer < best_t.size(); layer++) {
    int idx = best_t[layer];
    int bmm1 = get_mask(a[idx], a1);
    int bmm2 = get_mask(a[idx], a2);
    for (int bm1 = 0; bm1 < a1_size; bm1++) {
      for (int bm2 = 0; bm2 < a2_size; bm2++) {
        if (dp[bm1][bm2][layer]) {
          dp[bm1 & bmm1][bm2][layer + 1] = true;
          dp[bm1][bm2 & bmm2][layer + 1] = true;
        }
        if (dp[0][0][best_t.size()] == true) {
          bool f = true;
        }
      }
    }
  }
  if (!dp[0][0][best_t.size()]) return false;
  int now_bm1 = 0;
  int now_bm2 = 0;
  for (int layer = best_t.size() - 1; layer >= 0; layer--) {
    bool f = false;
    int idx = best_t[layer];
    int bmm1 = get_mask(a[idx], a1);
    int bmm2 = get_mask(a[idx], a2);
    for (int bm1 = 0; bm1 < a1_size; bm1++) {
      for (int bm2 = 0; bm2 < a2_size; bm2++) {
        if (dp[bm1][bm2][layer]) {
          if (((bm1 & bmm1) == now_bm1) && bm2 == now_bm2) {
            answer[idx] = 0;
            now_bm1 = bm1;
            f = true;
            break;
          }
          if (((bm2 & bmm2) == now_bm2) && bm1 == now_bm1) {
            answer[idx] = 1;
            now_bm2 = bm2;
            f = true;
            break;
          }
        }
      }
      if (f) break;
    }
  }
  answer[x1] = 0;
  answer[x2] = 1;
  return true;
}
void solve() {
  cin >> n;
  a.resize(n);
  answer.resize(n, 0);
  for (auto& i : a) cin >> i;
  auto begin = chrono::high_resolution_clock::now();
  if (n > 22) {
    while (chrono::duration_cast<chrono::milliseconds>(
               chrono::high_resolution_clock::now() - begin)
               .count() < 250) {
      int x1, x2;
      do {
        x1 = (int)get_rand(n);
        x2 = (int)get_rand(n);
      } while (x1 == x2);
      if (get_answer(x1, x2)) {
        cout << "YES\n";
        for (int i = 0; i < n; i++) {
          cout << answer[i] + 1 << " ";
        }
        return;
      }
    }
  } else {
    if (stupid()) {
      cout << "YES\n";
      for (int i = 0; i < n; i++) {
        cout << answer[i] + 1 << " ";
      }
      return;
    }
  }
  cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  srand(58164);
  init();
  solve();
}