#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int MAXN = 100010;
int n, m;
vector<int> edge[MAXN];
int qN, q[MAXN], tag[MAXN];
vector<int> a, b;
int col[MAXN], var;
bool vis[MAXN];
void divGraph() {
  memset(tag, -1, sizeof(tag));
  for (int i = 0; i < n; i++)
    if (tag[i] == -1) {
      qN = 0;
      q[qN++] = i;
      tag[i] = 0;
      a.push_back(i);
      for (int p = 0; p < qN; p++) {
        int u = q[p];
        for (int j = 0; j < edge[u].size(); j++) {
          int v = edge[u][j];
          if (tag[v] == -1) {
            q[qN++] = v;
            tag[v] = 1 - tag[u];
            if (!tag[v])
              a.push_back(v);
            else
              b.push_back(v);
          }
        }
      }
    }
  if (a.size() % 3 == 2) swap(a, b);
}
bool modifyI() {
  var = 0;
  for (int i = 0; i < a.size(); i++)
    if (b.size() - edge[a[i]].size() >= 2) {
      int u = a[i], cnt = 0;
      memset(vis, false, sizeof(vis));
      col[u] = var;
      for (int j = 0; j < edge[u].size(); j++) vis[edge[u][j]] = true;
      for (int v = 0; v < n; v++)
        if ((!vis[v]) && (tag[v] != tag[u])) {
          col[v] = var;
          if (++cnt >= 2) break;
        }
      var++;
      return true;
    }
  return false;
}
bool modifyII() {
  var = 0;
  for (int i = 0; i < b.size(); i++)
    if (a.size() - edge[b[i]].size() >= 2) {
      int u = b[i], cnt = 0;
      memset(vis, false, sizeof(vis));
      col[u] = var;
      for (int j = 0; j < edge[u].size(); j++) vis[edge[u][j]] = true;
      for (int v = 0; v < n; v++)
        if ((!vis[v]) && (tag[v] != tag[u])) {
          col[v] = var;
          if (++cnt >= 2) break;
        }
      if (++var >= 2) return true;
      ;
    }
  return false;
}
bool solve() {
  int cnt = 0;
  for (int i = 0; i < a.size(); i++)
    if (col[a[i]] == -1) {
      col[a[i]] = var;
      if (++cnt >= 3) var++, cnt = 0;
    }
  for (int i = 0; i < b.size(); i++)
    if (col[b[i]] == -1) {
      col[b[i]] = var;
      if (++cnt >= 3) var++, cnt = 0;
    }
  return true;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    edge[u].push_back(v), edge[v].push_back(u);
  }
  divGraph();
  memset(col, -1, sizeof(col));
  if (((a.size() % 3 == 0) || modifyI() || modifyII()) && solve()) {
    cout << "YES" << endl;
    for (int i = 0; i < n; i++)
      cout << col[i] + 1 << ((i == n - 1) ? '\n' : ' ');
  } else
    cout << "NO" << endl;
  return 0;
}
