#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n;
int m;
vector<int> v[100000];
set<pair<int, int> > all;
int was[100000], res[100000];
vector<int> w[2];
int go(int x, int y) {
  was[x] = 1;
  w[y].push_back(x);
  for (int i = 0; i < ((int)(v[x]).size()); i++)
    if (!was[v[x][i]]) go(v[x][i], y ^ 1);
  return 0;
}
int make() {
  int r = 1, rem = 3;
  for (int i = 0; i < ((int)(w[0]).size()); i++)
    if (!res[w[0][i]]) {
      res[w[0][i]] = r;
      rem--;
      if (!rem) {
        r++;
        rem = 3;
      }
    }
  for (int i = 0; i < ((int)(w[1]).size()); i++)
    if (!res[w[1][i]]) {
      res[w[1][i]] = r;
      rem--;
      if (!rem) {
        r++;
        rem = 3;
      }
    }
  return 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    v[a].push_back(b);
    v[b].push_back(a);
    all.insert(make_pair(a, b));
    all.insert(make_pair(b, a));
  }
  for (int i = 0; i < n; i++)
    if (!was[i]) go(i, 0);
  int ok = 0;
  if (((int)(w[0]).size()) % 3 == 0) {
    ok = 1;
    make();
  } else {
    if (((int)(w[0]).size()) % 3 == 2) swap(w[0], w[1]);
    int a = -1;
    for (int i = 0; i < ((int)(w[0]).size()); i++)
      if (((int)(v[w[0][i]]).size()) + 2 <= ((int)(w[1]).size())) {
        a = w[0][i];
        break;
      }
    if (a >= 0) {
      int b = -1, c = -1;
      for (int j = 0; j < ((int)(w[1]).size()); j++)
        if (!all.count(make_pair(a, w[1][j])))
          if (b == -1)
            b = w[1][j];
          else {
            c = w[1][j];
            break;
          }
      res[a] = res[b] = res[c] = n / 3;
      make();
      ok = 1;
    } else {
      int b = -1;
      for (int j = 0; j < ((int)(w[1]).size()); j++)
        if (((int)(v[w[1][j]]).size()) + 2 <= ((int)(w[0]).size()))
          if (a == -1)
            a = w[1][j];
          else {
            b = w[1][j];
            break;
          }
      if (b != -1) {
        int c = -1, d = -1;
        for (int j = 0; j < ((int)(w[0]).size()); j++)
          if (!all.count(make_pair(a, w[0][j])))
            if (c == -1)
              c = w[0][j];
            else {
              d = w[0][j];
              break;
            }
        res[a] = res[c] = res[d] = n / 3;
        c = d = -1;
        for (int j = 0; j < ((int)(w[0]).size()); j++)
          if (!all.count(make_pair(b, w[0][j])))
            if (c == -1)
              c = w[0][j];
            else {
              d = w[0][j];
              break;
            }
        res[b] = res[c] = res[d] = n / 3 - 1;
        make();
        ok = 1;
      }
    }
  }
  if (!ok)
    printf("NO\n");
  else {
    printf("YES\n");
    for (int i = 0; i < n; i++) printf("%d ", res[i]);
    printf("\n");
  }
  return 0;
}
