#include <bits/stdc++.h>
int n, m;
struct Edge {
  int s, t;
  int nxt;
} e[2 * 110000];
int p[110000], d[110000], c[110000], v[110000];
int stk[110000], top;
int main() {
  scanf("%d%d", &n, &m);
  memset(p, -1, sizeof(p));
  memset(d, 0, sizeof(p));
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    e[2 * i].s = x;
    e[2 * i].t = y;
    e[2 * i + 1].s = y;
    e[2 * i + 1].t = x;
    e[2 * i].nxt = p[x];
    p[x] = 2 * i;
    e[2 * i + 1].nxt = p[y];
    p[y] = 2 * i + 1;
    ++d[x];
    ++d[y];
  }
  memset(c, 0, sizeof(c));
  int c0 = 0, c1 = 0, c2 = 0;
  for (int i = 1; i <= n; i++)
    if (!c[i]) {
      c[i] = 1;
      stk[0] = i;
      top = 0;
      while (top >= 0) {
        int x = stk[top--];
        if (c[x] == 1)
          ++c1;
        else
          ++c2;
        if (d[x] == 0) ++c0;
        for (int y = p[x]; y >= 0; y = e[y].nxt)
          if (!c[e[y].t]) {
            c[e[y].t] = 3 - c[x];
            stk[++top] = e[y].t;
          }
      }
    }
  int cx = -1, dx = n + 1;
  if (c1 % 3 == 1) {
    if (c0 >= 1) {
      for (int i = 1; i <= n; i++)
        if (d[i] == 0) {
          c[i] = 2;
          c1--;
          c2++;
          break;
        }
    } else {
      cx = 1;
      dx = c2;
    }
  } else if (c1 % 3 == 2) {
    if (c0 >= 2) {
      for (int i = 1, j = 2; i <= n && j; i++)
        if (d[i] == 0) {
          c[i] = 2;
          --j;
          c1--;
          c2++;
        }
    } else {
      cx = 2;
      dx = c1;
    }
  }
  memset(v, 0, sizeof(v));
  if (cx >= 0) {
    int x, y, z;
    x = -1;
    for (int i = 1; i <= n; i++)
      if (c[i] == cx && d[i] <= dx - 2) {
        x = i;
        break;
      }
    if (x >= 0) {
      v[x] = 1;
      int cl = 2, cc = 3;
      y = -1;
      z = -1;
      for (int i = p[x]; i >= 0; i = e[i].nxt) {
        v[e[i].t] = cl;
        --cc;
        if (cc == 0) {
          ++cl;
          cc = 3;
        }
      }
      for (int i = 1; i <= n; i++)
        if (c[i] != cx && !v[i]) {
          if (y < 0) {
            v[i] = 1;
            y = i;
          } else if (z < 0) {
            v[i] = 1;
            z = i;
          } else {
            v[i] = cl;
            --cc;
            if (cc == 0) {
              ++cl;
              cc = 3;
            }
          }
        }
      assert(cc == 3);
      for (int i = 1; i <= n; i++)
        if (c[i] == cx && !v[i]) {
          v[i] = cl;
          --cc;
          if (cc == 0) {
            ++cl;
            cc = 3;
          }
        }
    } else {
      x = -1;
      y = -1;
      cx = 3 - cx;
      dx = c1 + c2 - dx;
      for (int i = 1; i <= n; i++)
        if (c[i] == cx && d[i] <= dx - 2) {
          if (x < 0)
            x = i;
          else if (y < 0) {
            y = i;
            break;
          }
        }
      if (y >= 0) {
        int ux = 2, uy = 2;
        v[x] = 1;
        v[y] = 2;
        int cl = 3, cc = 3;
        for (int i = p[x]; i >= 0; i = e[i].nxt) c[e[i].t] |= 4;
        for (int i = p[y]; i >= 0; i = e[i].nxt) c[e[i].t] |= 8;
        for (int i = p[x]; i >= 0 && uy; i = e[i].nxt) {
          if (!(c[e[i].t] & 8)) {
            v[e[i].t] = 2;
            --uy;
          }
        }
        for (int i = p[y]; i >= 0 && ux; i = e[i].nxt) {
          if (!(c[e[i].t] & 4)) {
            v[e[i].t] = 1;
            --ux;
          }
        }
        for (int i = 1; i <= n; i++)
          if (c[i] != cx && !v[i]) {
            if (ux > 0 && !(c[i] & 4)) {
              v[i] = 1;
              --ux;
            } else if (uy > 0 && !(c[i] & 8)) {
              v[i] = 2;
              --uy;
            } else {
              v[i] = cl;
              --cc;
              if (cc == 0) {
                ++cl;
                cc = 3;
              }
            }
          }
        assert(cc == 3);
        for (int i = 1; i <= n; i++)
          if (c[i] == cx && !v[i]) {
            v[i] = cl;
            --cc;
            if (cc == 0) {
              ++cl;
              cc = 3;
            }
          }
      } else {
        printf("NO\n");
        return 0;
      }
    }
  } else {
    int cl = 1, cc = 3;
    for (cx = 1; cx <= 2; cx++) {
      assert(cc == 3);
      for (int i = 1; i <= n; i++)
        if (c[i] == cx) {
          v[i] = cl;
          --cc;
          if (cc == 0) {
            ++cl;
            cc = 3;
          }
        }
    }
  }
  printf("YES\n");
  for (int i = 1; i <= n; i++) printf("%d%c", v[i], (i < n ? ' ' : '\n'));
  return 0;
}
