#include <bits/stdc++.h>
using namespace std;
int n, m;
int ct[100005];
int ans[100005];
vector<int> adjlist[100005];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    adjlist[a].push_back(b);
    adjlist[b].push_back(a);
    ct[a]++, ct[b]++;
  }
  for (int i = 0; i < n; i++) {
    sort(adjlist[i].begin(), adjlist[i].end());
  }
  memset(ans, -1, sizeof(ans));
  vector<int> v[3];
  for (int k = 0; k <= 2; k++) {
    int sel = -1;
    for (int i = 0; i < n; i++) {
      if (ans[i] == -1) {
        sel = i;
        break;
      }
    }
    if (sel == -1) {
      printf("-1");
      return 0;
    }
    ans[sel] = k;
    v[k].push_back(sel);
    int cur = 0;
    for (int i = sel + 1; i < n; i++) {
      while (cur < adjlist[sel].size() && adjlist[sel][cur] < i) cur++;
      if (cur == adjlist[sel].size() || adjlist[sel][cur] > i) {
        ans[i] = k;
        v[k].push_back(i);
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (ans[i] == -1) {
      printf("-1");
      return 0;
    }
  }
  for (int i = 0; i < 3; i++) {
    for (auto x : v[i]) {
      for (auto y : adjlist[x]) {
        if (ans[y] == ans[x]) {
          printf("-1");
          return 0;
        }
      }
    }
  }
  long long check = 0;
  check += v[0].size() * v[1].size();
  check += v[1].size() * v[2].size();
  check += v[2].size() * v[0].size();
  if (check != m) {
    printf("-1");
    return 0;
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", ans[i] + 1);
  }
}
