#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T& x) {
  static char c;
  static int f;
  for (c = getchar(), f = 1; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -f;
  for (x = 0; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + (c & 15);
  x *= f;
}
template <typename T>
void write(T x) {
  static char q[65];
  int cnt = 0;
  if (x < 0) putchar('-'), x = -x;
  q[++cnt] = x % 10, x /= 10;
  while (x) q[++cnt] = x % 10, x /= 10;
  while (cnt) putchar(q[cnt--] + '0');
}
const int maxn = 100005, maxm = 100005;
struct Edge {
  int v, nt;
  Edge(int v = 0, int nt = 0) : v(v), nt(nt) {}
} e[maxm * 2];
int hd[maxn], num;
void qwq(int u, int v) { e[++num] = Edge(v, hd[u]), hd[u] = num; }
int col[maxn], st[3][maxn], cnt[3], vis[maxn];
void dfs(int u) {
  int c = col[u];
  st[c][++cnt[c]] = u;
  for (int i = hd[u]; i; i = e[i].nt) {
    int v = e[i].v;
    if (col[v]) continue;
    col[v] = 3 - c;
    dfs(v);
  }
}
int main() {
  int n, m, Spe = 0;
  read(n), read(m);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    read(u), read(v);
    qwq(u, v);
    qwq(v, u);
  }
  for (int i = 1; i <= n; ++i) {
    if (col[i]) continue;
    col[i] = 1;
    dfs(i);
  }
  int tot = 1;
  if (cnt[1] % 3 == 0) {
    puts("YES");
    Spe = 1;
    for (int i = 1; i <= cnt[1]; ++i) {
      col[st[1][i]] = tot;
      if (i % 3 == 0) ++tot;
    }
    for (int i = 1; i <= cnt[2]; ++i) {
      col[st[2][i]] = tot;
      if (i % 3 == 0) ++tot;
    }
    for (int i = 1; i <= n; ++i) write(col[i]), putchar(" \n"[i == n]);
  } else {
    if (cnt[1] % 3 == 2) {
      swap(st[1], st[2]);
      swap(cnt[1], cnt[2]);
    }
    int s0 = 0;
    for (int i = 1; i <= cnt[1] && !s0; ++i) {
      int u = st[1][i], sum = 0;
      for (int j = hd[u]; j; j = e[j].nt) {
        int v = e[j].v;
        ++sum;
      }
      if (sum + 2 <= cnt[2]) s0 = i;
    }
    if (s0) {
      for (int j = hd[st[1][s0]]; j; j = e[j].nt) {
        int v = e[j].v;
        vis[v] = true;
      }
      int s1 = 0, s2 = 0;
      for (int i = 1; i <= cnt[2] && !s2; ++i) {
        int u = st[2][i];
        if (vis[u]) continue;
        if (s1)
          s2 = i;
        else
          s1 = i;
      }
      memset(vis, 0, sizeof vis);
      int sum = 0;
      for (int i = 1; i <= cnt[1]; ++i) {
        if (i == s0) continue;
        col[st[1][i]] = tot;
        if ((++sum) == 3) sum = 0, ++tot;
      }
      for (int i = 1; i <= cnt[2]; ++i) {
        if (i == s1 || i == s2) continue;
        col[st[2][i]] = tot;
        if ((++sum) == 3) sum = 0, ++tot;
      }
      col[st[1][s0]] = col[st[2][s1]] = col[st[2][s2]] = tot++;
      puts("YES");
      Spe = 2;
      for (int i = 1; i <= n; ++i) write(col[i]), putchar(" \n"[i == n]);
    } else {
      int s0 = 0, s1 = 0;
      for (int i = 1; i <= cnt[2] && !s1; ++i) {
        int u = st[2][i], sum = 0;
        for (int j = hd[u]; j; j = e[j].nt) {
          int v = e[j].v;
          ++sum;
        }
        if (sum + 2 <= cnt[1]) {
          if (s0)
            s1 = i;
          else
            s0 = i;
        }
      }
      if (!s1)
        return puts("NO"), 0;
      else {
        int s2 = 0, s3 = 0, s4 = 0, s5 = 0;
        for (int i = hd[st[2][s0]]; i; i = e[i].nt) {
          int v = e[i].v;
          vis[v] = true;
        }
        for (int i = 1; i <= cnt[1] && !s3; ++i) {
          int u = st[1][i];
          if (vis[u]) continue;
          if (s2)
            s3 = i;
          else
            s2 = i;
        }
        memset(vis, 0, sizeof vis);
        for (int i = hd[st[2][s1]]; i; i = e[i].nt) {
          int v = e[i].v;
          vis[v] = true;
        }
        for (int i = 1; i <= cnt[1] && !s5; ++i) {
          int u = st[1][i];
          if (vis[u]) continue;
          if (s4)
            s5 = i;
          else
            s4 = i;
        }
        memset(vis, 0, sizeof vis);
        int sum = 0;
        for (int i = 1; i <= cnt[1]; ++i) {
          if (i == s2 || i == s3 || i == s4 || i == s5) continue;
          col[st[1][i]] = tot;
          if ((++sum) == 3) sum = 0, ++tot;
        }
        for (int i = 1; i <= cnt[2]; ++i) {
          if (i == s0 || i == s1) continue;
          col[st[2][i]] = tot;
          if ((++sum) == 3) sum = 0, ++tot;
        }
        col[st[2][s0]] = col[st[1][s2]] = col[st[1][s3]] = tot++;
        col[st[2][s1]] = col[st[1][s4]] = col[st[1][s5]] = tot++;
        puts("YES");
        Spe = 3;
        for (int i = 1; i <= n; ++i) write(col[i]), putchar(" \n"[i == n]);
      }
    }
  }
  if ((tot - 1) * 3 != n) write(Spe), putchar('\n');
  return 0;
}
