#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:60000000")
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
double const pi = 3.1415926535897932384626433832795;
int const inf = (int)1e9;
long long const inf64 = (long long)4e18;
const string name = "d";
const int NMAX = 100100;
int n, m, k, used[NMAX], ans[NMAX], us[NMAX];
vector<int> g[NMAX], x, y;
void dfs(int v, int zn) {
  if (zn == 0)
    x.push_back(v);
  else
    y.push_back(v);
  used[v] = 1;
  for (int i = 0; i < (int)g[v].size(); i++)
    if (!used[g[v][i]]) dfs(g[v][i], zn ^ 1);
}
void answer(int now) {
  now++;
  int cnt = 0;
  for (int i = 0; i < (int)x.size(); i++)
    if (ans[x[i]] == 0) {
      cnt++;
      ans[x[i]] = now;
      if (cnt == 3) cnt = 0, now++;
    }
  for (int i = 0; i < (int)y.size(); i++)
    if (ans[y[i]] == 0) {
      cnt++;
      ans[y[i]] = now;
      if (cnt == 3) cnt = 0, now++;
    }
  cout << "YES" << endl;
  for (int i = 0; i < (int)n; i++) cout << ans[i] << " ";
  cout << endl;
  exit(0);
}
int main() {
  cin >> n >> m;
  k = n / 3;
  for (int i = 0; i < (int)m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  memset(used, 0, sizeof(used));
  memset(ans, 0, sizeof(ans));
  for (int i = 0; i < (int)n; i++)
    if (!used[i]) dfs(i, 0);
  if (x.size() % 3 == 0)
    answer(0);
  else {
    if (x.size() % 3 == 2) swap(x, y);
    for (int i = 0; i < (int)x.size(); i++)
      if ((int)g[x[i]].size() <= (int)y.size() - 2) {
        ans[x[i]] = 1;
        int cnt = 0;
        memset(used, 0, sizeof(used));
        for (int j = 0; j < (int)g[x[i]].size(); j++) used[g[x[i]][j]] = 1;
        for (int j = 0; j < (int)y.size(); j++)
          if (!used[y[j]] && cnt < 2) cnt++, ans[y[j]] = 1;
        answer(1);
      }
    memset(us, 0, sizeof(us));
    int calc = 0;
    if (y.size() % 3 == 2) swap(x, y);
    for (int i = 0; i < (int)x.size(); i++)
      if ((int)g[x[i]].size() <= (int)y.size() - 2) {
        ans[x[i]] = calc + 1;
        int cnt = 0;
        memset(used, 0, sizeof(used));
        for (int j = 0; j < (int)g[x[i]].size(); j++) used[g[x[i]][j]] = 1;
        for (int j = 0; j < (int)y.size(); j++)
          if (!used[y[j]] && cnt < 2) cnt++, ans[y[j]] = calc + 1;
        calc++;
        if (calc == 2) answer(2);
      }
  }
  cout << "NO" << endl;
  return 0;
}
