#include <bits/stdc++.h>
using namespace std;
struct side {
  int a, l;
} e[100005 * 2];
int start[100005], n, m, tot, d[100005], ans[100005];
int wh[100005], bl[100005], n1, n2, q[100005], p, bb[100005];
bool co[100005], vis[100005], bo[100005], del[100005];
void add(int x, int y) {
  d[x]++;
  d[y]++;
  e[++tot].l = start[x];
  e[tot].a = y;
  start[x] = tot;
  e[++tot].l = start[y];
  e[tot].a = x;
  start[y] = tot;
}
void bfs(int x) {
  int h = 0, t = 0;
  co[x] = 0;
  q[t = 1] = x;
  vis[x] = 1;
  while (h != t) {
    x = q[++h];
    if (co[x]) {
      bl[++n2] = x;
    } else
      wh[++n1] = x;
    for (int i = start[x]; i; i = e[i].l)
      if (!vis[e[i].a]) {
        q[++t] = e[i].a;
        co[e[i].a] = co[x] ^ 1;
        vis[q[t]] = 1;
      }
  }
}
int po[100005], kk[100005][2], cnt[100005];
bool check(int k) {
  if (k == 1) {
    int bbb = 0;
    for (int i = 1; i <= n1; ++i) {
      int x = wh[i];
      if (d[x] == n2) continue;
      for (int i = start[x]; i; i = e[i].l) bb[e[i].a] = x;
      for (int j = 1; j <= n2; ++j)
        if (bb[bl[j]] != x) {
          po[x] = bl[j];
          cnt[bl[j]]++;
          if (cnt[bl[j]] == 2) ++bbb;
          if (cnt[bl[j]] <= 2) kk[bl[j]][cnt[bl[j]] - 1] = x;
          break;
        }
    }
    if (bbb < 2) {
      puts("NO");
      exit(0);
    }
    bbb = 2;
    for (int j = 1; j <= n2; ++j)
      if (cnt[bl[j]] >= 2) {
        del[bl[j]] = 1;
        del[kk[bl[j]][0]] = 1;
        del[kk[bl[j]][1]] = 1;
        ans[bl[j]] = ++p;
        ans[kk[bl[j]][0]] = p;
        ans[kk[bl[j]][1]] = p;
        --bbb;
        if (!bbb) break;
      }
  } else {
    int bbb = 0;
    for (int i = 1; i <= n2; ++i) {
      int x = bl[i];
      if (d[x] == n1) continue;
      for (int i = start[x]; i; i = e[i].l) bb[e[i].a] = x;
      for (int j = 1; j <= n1; ++j)
        if (bb[wh[j]] != x) {
          po[x] = wh[j];
          cnt[wh[j]]++;
          if (cnt[wh[j]] == 2) ++bbb;
          if (cnt[wh[j]] <= 2) kk[wh[j]][cnt[wh[j]] - 1] = x;
          break;
        }
    }
    if (bbb < 2) {
      puts("NO");
      exit(0);
    }
    bbb = 2;
    for (int j = 1; j <= n1; ++j)
      if (cnt[wh[j]] >= 2) {
        del[wh[j]] = 1;
        del[kk[wh[j]][0]] = 1;
        del[kk[wh[j]][1]] = 1;
        ans[wh[j]] = ++p;
        ans[kk[wh[j]][0]] = p;
        ans[kk[wh[j]][1]] = p;
        --bbb;
        if (!bbb) break;
      }
  }
  int now;
  now = 3;
  for (int i = 1; i <= n1; ++i) {
    if (del[wh[i]]) continue;
    ++now;
    if (now > 3) now = 1, ++p;
    ans[wh[i]] = p;
  }
  now = 3;
  for (int i = 1; i <= n2; ++i) {
    if (del[bl[i]]) continue;
    ++now;
    if (now > 3) now = 1, ++p;
    ans[bl[i]] = p;
  }
  puts("YES");
  for (int i = 1; i <= n - 1; ++i) printf("%d ", ans[i]);
  printf("%d\n", ans[n]);
}
int main() {
  int x, y;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    add(x, y);
  }
  for (int i = 1; i <= n; ++i)
    if (!vis[i]) bfs(i);
  int p = 0, now;
  if (n1 % 3 == 0 && n2 % 3 == 0) {
    now = 3;
    for (int i = 1; i <= n1; ++i) {
      ++now;
      if (now > 3) now = 1, ++p;
      ans[wh[i]] = p;
    }
    now = 3;
    for (int i = 1; i <= n2; ++i) {
      ++now;
      if (now > 3) now = 1, ++p;
      ans[bl[i]] = p;
    }
    puts("YES");
    for (int i = 1; i <= n - 1; ++i) printf("%d ", ans[i]);
    printf("%d\n", ans[n]);
  } else {
    if (n1 % 3 == 1) {
      x = 0;
      for (int i = 1; i <= n1; ++i)
        if (d[wh[i]] <= n2 - 2) {
          x = wh[i];
          break;
        }
      if (!x) {
        check(1);
        return 0;
      }
      del[x] = 1;
      ans[x] = 1;
      for (int i = start[x]; i; i = e[i].l) bo[e[i].a] = 1;
      y = 0;
      for (int i = 1; i <= n2; ++i)
        if (!bo[bl[i]]) {
          ++y;
          del[bl[i]] = 1;
          ans[bl[i]] = 1;
          if (y == 2) break;
        }
    } else {
      x = 0;
      for (int i = 1; i <= n2; ++i)
        if (d[bl[i]] <= n1 - 2) {
          x = bl[i];
          break;
        }
      if (!x) {
        check(2);
        return 0;
      }
      del[x] = 1;
      ans[x] = 1;
      for (int i = start[x]; i; i = e[i].l) bo[e[i].a] = 1;
      y = 0;
      for (int i = 1; i <= n1; ++i)
        if (!bo[wh[i]]) {
          ++y;
          del[wh[i]] = 1;
          ans[wh[i]] = 1;
          if (y == 2) break;
        }
    }
    p = 1;
    now = 3;
    for (int i = 1; i <= n1; ++i) {
      if (del[wh[i]]) continue;
      ++now;
      if (now > 3) now = 1, ++p;
      ans[wh[i]] = p;
    }
    now = 3;
    for (int i = 1; i <= n2; ++i) {
      if (del[bl[i]]) continue;
      ++now;
      if (now > 3) now = 1, ++p;
      ans[bl[i]] = p;
    }
    puts("YES");
    for (int i = 1; i <= n - 1; ++i) printf("%d ", ans[i]);
    printf("%d\n", ans[n]);
  }
  return 0;
}
