#include <bits/stdc++.h>
using namespace std;
int n, m, fs[100010], to[300010], nx[300010], e, sz[300010], as, bs, l[300010],
    op, ed, yoo, aya, ans[100010];
bool p[100010], done[100010], q[100010], r[100010];
void ins(int x, int y) {
  nx[++e] = fs[x];
  fs[x] = e;
  to[e] = y;
  nx[++e] = fs[y];
  fs[y] = e;
  to[e] = x;
}
int main() {
  cin >> n >> m;
  for (int i = 1, x, y; i <= m; ++i) {
    cin >> x >> y;
    ins(x, y);
    sz[x]++;
    sz[y]++;
  }
  for (int i = 1; i <= n; ++i)
    if (!done[i]) {
      for (done[l[op = ed = 0] = i] = 1; op <= ed; ++op)
        for (int v = fs[l[op]]; v; v = nx[v])
          if (!done[to[v]]) {
            done[to[v]] = 1;
            p[to[v]] = p[l[op]] ^ 1;
            l[++ed] = to[v];
          }
    }
  for (int i = 1; i <= n; ++i)
    if (!p[i])
      as++;
    else
      bs++;
  if (as % 3 == 0) {
    cout << "YES" << endl;
    int out = 0;
    for (int i = 1; i <= n; ++i)
      if (p[i]) ans[i] = (out++) / 3 + 1;
    for (int i = 1; i <= n; ++i)
      if (!p[i]) ans[i] = (out++) / 3 + 1;
    for (int i = 1; i <= n; ++i) cout << ans[i] << ' ';
    cout << endl;
    return 0;
  }
  if (as % 3 == 2) {
    for (int i = 1; i <= n; ++i) p[i] ^= 1;
    swap(as, bs);
  }
  for (int i = 1; i <= n; ++i)
    if (!p[i]) {
      if (sz[i] <= bs - 2) {
        cout << "YES" << endl;
        int out = 3;
        ans[i] = 1;
        for (int v = fs[i]; v; v = nx[v])
          if (p[to[v]]) q[to[v]] = 1;
        for (int j = 1, k = 0; j <= n && k < 2; ++j)
          if (p[j] && !q[j]) {
            ans[j] = 1;
            k++;
          }
        for (int j = 1; j <= n; ++j)
          if (!p[j] && j != i) ans[j] = (out++) / 3 + 1;
        for (int j = 1; j <= n; ++j)
          if (p[j] && ans[j] != 1) ans[j] = (out++) / 3 + 1;
        for (int j = 1; j <= n; ++j) cout << ans[j] << ' ';
        cout << endl;
        return 0;
      }
    }
  memset(q, 0, sizeof q);
  for (int i = 1; i <= n; ++i)
    if (p[i] && (yoo == 0 || as - sz[i] > as - sz[yoo])) yoo = i;
  for (int v = fs[yoo]; v; v = nx[v]) q[to[v]] = 1;
  int opt = 0;
  for (int i = 1; i <= n; ++i)
    if (p[i] && i != yoo && as - sz[i] >= 2) {
      int c = 0, a = as - sz[yoo], b = as - sz[i];
      for (int v = fs[i]; v; v = nx[v])
        if (!q[to[v]]) c++;
      c = a - c;
      if (a >= 2 && b >= 2 && a + b - c >= 4) {
        int out = 6, k = 0;
        cout << "YES" << endl;
        for (int v = fs[i]; v; v = nx[v]) r[to[v]] = 1;
        ans[i] = 1;
        for (int j = 1; j <= n && k < 2; ++j)
          if (!p[j] && !r[j] && q[j]) {
            ans[j] = 1;
            k++;
          }
        for (int j = 1; j <= n && k < 2; ++j)
          if (!p[j] && !r[j]) {
            ans[j] = 1;
            k++;
          }
        k = 0;
        ans[yoo] = 2;
        for (int j = 1; j <= n && k < 2; ++j)
          if (!p[j] && !q[j] && !ans[j]) {
            ans[j] = 2;
            k++;
          }
        for (int j = 1; j <= n; ++j)
          if (!p[j] && !ans[j]) ans[j] = (out++) / 3 + 1;
        for (int j = 1; j <= n; ++j)
          if (p[j] && !ans[j]) ans[j] = (out++) / 3 + 1;
        for (int j = 1; j <= n; ++j) cout << ans[j] << ' ';
        cout << endl;
        return 0;
      }
    }
  cout << "NO" << endl;
  return 0;
}
