#include <bits/stdc++.h>
using namespace std;
const int MX = 100005;
set<int> neigh[MX];
bool vis[MX];
bool col[MX];
void dfs(int v) {
  if (vis[v]) return;
  vis[v] = true;
  for (int u : neigh[v]) {
    col[u] = !col[v];
    dfs(u);
  }
}
int ans[MX];
int nextCol = 1;
bool FindAndColor(int v, vector<int>& R) {
  vector<int> to;
  for (int u : R) {
    if (neigh[v].count(u) == 0) {
      to.push_back(u);
      if (to.size() == 2) break;
    }
  }
  if (to.size() < 2) return false;
  ans[v] = nextCol;
  ans[to[0]] = nextCol;
  ans[to[1]] = nextCol;
  nextCol++;
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    neigh[u].insert(v);
    neigh[v].insert(u);
  }
  for (int v = 1; v <= n; v++) {
    dfs(v);
  }
  vector<int> L, R;
  for (int v = 1; v <= n; v++) {
    if (col[v])
      L.push_back(v);
    else
      R.push_back(v);
  }
  if (L.size() % 3 == 2) swap(L, R);
  if (L.size() % 3 == 1) {
    bool ok = false;
    for (int v : L) {
      if (FindAndColor(v, R)) {
        ok = true;
        break;
      }
    }
    if (!ok) {
      int c = 0;
      for (int u : R) {
        if (FindAndColor(u, L)) {
          c++;
          if (c == 2) break;
        }
      }
      if (c < 2) {
        cout << "NO\n";
        return 0;
      }
    }
  }
  cout << "YES\n";
  int rem = 3;
  for (int v : L) {
    if (ans[v]) continue;
    if (!rem) {
      nextCol++;
      rem = 3;
    }
    ans[v] = nextCol;
    rem--;
  }
  for (int u : R) {
    if (ans[u]) continue;
    if (!rem) {
      nextCol++;
      rem = 3;
    }
    ans[u] = nextCol;
    rem--;
  }
  for (int v = 1; v <= n; v++) cout << ans[v] << " ";
}
