#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int MN = 100111;
int n, m, side[MN], visited[MN], res[MN];
vector<int> ke[MN];
vector<int> l1, l2;
void dfs(int u, int color, int &a, int &b) {
  side[u] = color;
  if (color == 0)
    a++;
  else
    b++;
  for (int i = 0, _a = (ke[u].size()); i < _a; i++) {
    int v = ke[u][i];
    if (side[v] < 0) {
      dfs(v, 1 - color, a, b);
    }
  }
}
void dfs2(int u) {
  visited[u] = 1;
  side[u] = 1 - side[u];
  for (int i = 0, _a = (ke[u].size()); i < _a; i++) {
    int v = ke[u][i];
    if (!visited[v]) {
      dfs2(v);
    }
  }
}
void reverse(int u) {
  memset(visited, 0, sizeof visited);
  dfs2(u);
}
int main() {
  while (scanf("%d%d", &n, &m) == 2) {
    memset(res, -1, sizeof res);
    for (int i = (1), _b = (n); i <= _b; i++) ke[i].clear();
    int u, v;
    while (m--) {
      scanf("%d%d", &u, &v);
      ke[u].push_back(v);
      ke[v].push_back(u);
    }
    memset(side, -1, sizeof side);
    l1.clear();
    l2.clear();
    for (int i = (1), _b = (n); i <= _b; i++)
      if (side[i] < 0) {
        int a = 0, b = 0;
        dfs(i, 0, a, b);
        if ((a - b + 3) % 3 == 1)
          l1.push_back(i);
        else if ((a - b + 3) % 3 == 2)
          l2.push_back(i);
      }
    int sum = n;
    for (int i = (1), _b = (n); i <= _b; i++) sum -= side[i];
    bool can = true;
    int cur = 1;
    if (sum % 3 == 0) {
    } else {
      if (sum % 3 == 2) {
        swap(l1, l2);
        for (int i = (1), _b = (n); i <= _b; i++) side[i] = 1 - side[i];
      }
      if (l1.size() > 0) {
        reverse(l1[0]);
      } else if (l2.size() > 1) {
        reverse(l2[0]);
        reverse(l2[1]);
      } else {
        can = false;
        memset(visited, 0, sizeof visited);
        int n1 = 0;
        for (int i = (1), _b = (n); i <= _b; i++)
          if (side[i] == 1) n1++;
        int n0 = n - n1;
        for (int i = (1), _b = (n); i <= _b; i++)
          if (side[i] == 0 && ke[i].size() <= n1 - 2) {
            for (int x = 0, _a = (ke[i].size()); x < _a; x++) {
              int j = ke[i][x];
              visited[j] = 1;
            }
            int u = -1, v = -1;
            for (int j = (1), _b = (n); j <= _b; j++)
              if (side[j] == 1 && !visited[j]) {
                if (u == -1)
                  u = j;
                else if (v == -1)
                  v = j;
              }
            if (u > 0 && v > 0) {
              can = true;
              side[i] = 1 - side[i];
              side[u] = 1 - side[u];
              side[v] = 1 - side[v];
              res[i] = res[u] = res[v] = cur++;
              break;
            }
            for (int x = 0, _a = (ke[i].size()); x < _a; x++) {
              int j = ke[i][x];
              visited[j] = 0;
            }
          }
        if (!can) {
          int _ = 0;
          for (int i1 = (1), _b = (n); i1 <= _b; i1++)
            if (side[i1] == 1 && ke[i1].size() <= n0 - 2)
              if (!can) {
                int __ = 0;
                for (int i2 = (i1 + 1), _b = (n); i2 <= _b; i2++)
                  if (side[i2] == 1 && ke[i2].size() <= n0 - 2) {
                    __++;
                    if (__ == 5) break;
                    for (int x = 0, _a = (ke[i1].size()); x < _a; x++)
                      visited[ke[i1][x]] = 1;
                    for (int x = 0, _a = (ke[i2].size()); x < _a; x++)
                      visited[ke[i2][x]] += 2;
                    int j1 = -1, j2 = -1, j3 = -1, j4 = -1;
                    for (int j = (1), _b = (n); j <= _b; j++)
                      if (side[j] == 0)
                        if (visited[j] & 1)
                          if (visited[j] < 2) {
                            if (j3 < 0)
                              j3 = j;
                            else if (j4 < 0)
                              j4 = j;
                          }
                    for (int j = (1), _b = (n); j <= _b; j++)
                      if (side[j] == 0)
                        if (visited[j] >= 2)
                          if ((visited[j] & 1) == 0) {
                            if (j1 < 0)
                              j1 = j;
                            else if (j2 < 0)
                              j2 = j;
                          }
                    for (int j = (1), _b = (n); j <= _b; j++)
                      if (side[j] == 0)
                        if (!visited[j]) {
                          if (j1 < 0)
                            j1 = j;
                          else if (j2 < 0)
                            j2 = j;
                          else if (j3 < 0)
                            j3 = j;
                          else if (j4 < 0)
                            j4 = j;
                        }
                    if (j1 > 0 && j2 > 0 && j3 > 0 && j4 > 0) {
                      can = true;
                      res[i1] = res[j1] = res[j2] = cur++;
                      res[i2] = res[j3] = res[j4] = cur++;
                      side[i1] = 1 - side[i1];
                      side[i2] = 1 - side[i2];
                      side[j1] = 1 - side[j1];
                      side[j2] = 1 - side[j2];
                      side[j3] = 1 - side[j3];
                      side[j4] = 1 - side[j4];
                      break;
                    }
                    for (int x = 0, _a = (ke[i1].size()); x < _a; x++)
                      visited[ke[i1][x]] = 0;
                    for (int x = 0, _a = (ke[i2].size()); x < _a; x++)
                      visited[ke[i2][x]] = 0;
                  }
                _++;
                if (_ == 2) break;
              }
        }
      }
    }
    if (!can) {
      puts("NO");
      continue;
    }
    puts("YES");
    int has = 0;
    for (int turn = 0, _a = (2); turn < _a; turn++) {
      for (int i = (1), _b = (n); i <= _b; i++)
        if (side[i] == turn && res[i] < 0) {
          res[i] = cur;
          has++;
          if (has == 3) {
            cur++;
            has = 0;
          }
        }
    }
    for (int i = (1), _b = (n); i <= _b; i++) printf("%d ", res[i]);
    puts("");
  }
  return 0;
}
