#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<int> g[N];
int ans[N], vis[N], num[10];
int main() {
  int n, m, a, b;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int f = 1;
  for (auto it : g[1]) vis[it] = -1;
  int num1 = 0, num2 = 0, num3 = 0;
  for (int i = 1; i <= n; i++)
    if (vis[i] == 0) ans[i] = 1;
  int se = 0;
  for (int i = 1; i <= n; i++)
    if (ans[i] == 0) {
      se = i;
      break;
    }
  if (se == 0) f = 0;
  for (auto it : g[se]) {
    vis[it] = -2;
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i] == -1) ans[i] = 2;
  }
  int th = 0;
  for (int i = 1; i <= n; i++)
    if (ans[i] == 0) {
      th = i;
      break;
    }
  if (th == 0) f = 0;
  for (auto it : g[th]) vis[it] = -3;
  for (int i = 1; i <= n; i++)
    if (vis[i] == -2) ans[i] = 3;
  for (int i = 1; i <= n; i++)
    if (ans[i] == 0) f = 0;
  for (int i = 1; i <= n; i++) num[ans[i]]++;
  if (num[0]) f = 0;
  for (int i = 1; i <= n; i++) {
    if (g[i].size() != n - num[ans[i]]) f = 0;
    for (auto it : g[i])
      if (ans[i] == ans[it]) f = 0;
  }
  if (f == 0)
    printf("-1\n");
  else {
    for (int i = 1; i <= n; i++) {
      if (i == 1)
        printf("%d", ans[i]);
      else
        printf(" %d", ans[i]);
    }
    printf("\n");
  }
  return 0;
}
