#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
vector<int> vec[maxn], ve[10];
int pre[maxn];
bool vis[maxn];
bool dfs(int u) {
  vis[u] = true;
  for (auto v : vec[u]) {
    if (pre[v] == pre[u]) {
      return false;
    }
    if (vis[v] == false) {
      if (dfs(v) == false) {
        return false;
      }
    }
  }
  return true;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    vec[u].push_back(v);
    vec[v].push_back(u);
  }
  for (auto v : vec[1]) {
    pre[v] = 1;
  }
  int t = 1;
  for (int i = 1; i <= n; i++) {
    if (pre[i] == 1) {
      t = i;
      break;
    }
  }
  for (auto v : vec[t]) {
    if (pre[v] == 1) {
      pre[v] = 2;
    }
  }
  for (int i = 1; i <= n; i++) {
    ve[pre[i]].push_back(i);
  }
  bool ok = true;
  for (int i = 0; i < 3; i++) {
    if (ok == false) break;
    for (auto x : ve[i]) {
      if (vec[x].size() != n - ve[i].size()) {
        ok = false;
        break;
      }
    }
  }
  if (ve[2].size() == 0) {
    ok = false;
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i] == false) {
      if (dfs(i) == false) {
        ok = false;
        break;
      }
    }
    if (ok == false) {
      break;
    }
  }
  if (ok) {
    for (int i = 1; i <= n; i++) {
      cout << pre[i] + 1 << ' ';
    }
    cout << endl;
  } else {
    puts("-1");
  }
  return 0;
}
