#include <bits/stdc++.h>
using namespace std;
const int n1 = 1e5 + 5;
vector<int> G[n1];
bool vi[n1];
int cnt;
void dfs(int r) {
  vi[r] = 1;
  cnt++;
  for (int i = 0; i < G[r].size(); ++i) {
    if (vi[G[r][i]] == 0) {
      dfs(G[r][i]);
    }
  }
}
bool ncon(int n) {
  for (int i = 0; i < n1; ++i) {
    vi[i] = 0;
  }
  cnt = 0;
  dfs(1);
  if (cnt == n)
    return false;
  else
    return true;
}
int main() {
  int n, e;
  cin >> n >> e;
  for (int i = 0; i < e; ++i) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  if (ncon(n)) {
    cout << "-1\n";
    return 0;
  }
  set<int> sa;
  for (int i = 0; i < n; ++i) {
    sa.insert(i + 1);
  }
  set<int> sb;
  for (int i = 0; i < G[1].size(); ++i) {
    int r = G[1][i];
    sb.insert(r);
    sa.erase(r);
  }
  if (sb.size() <= 1) {
    cout << "-1";
    return 0;
  }
  int ano = *(sb.begin());
  set<int> sc;
  for (int i = 0; i < G[ano].size(); ++i) {
    int r = G[ano][i];
    if (sb.find(r) != sb.end()) {
      sb.erase(r);
      sc.insert(r);
    }
  }
  if (sc.size() <= 0) {
    cout << "-1\n";
    return 0;
  }
  bool finch = 0;
  set<int>::iterator it = sa.begin();
  int ans[n + 1];
  for (; it != sa.end(); ++it) {
    int r = (*it);
    for (int j = 0; j < G[r].size(); ++j) {
      int r1 = G[r][j];
      if (sa.find(r1) != sa.end()) {
        finch = 1;
        break;
      }
    }
    int uio = sb.size();
    int kl = sc.size();
    uio += kl;
    if (uio != G[r].size()) {
      finch = 1;
      break;
    }
    ans[r] = 1;
  }
  it = sb.begin();
  for (; it != sb.end(); ++it) {
    int r = (*it);
    for (int j = 0; j < G[r].size(); ++j) {
      int r1 = G[r][j];
      if (sb.find(r1) != sb.end()) {
        finch = 1;
        break;
      }
    }
    int uio = sa.size();
    int kl = sc.size();
    uio += kl;
    if (uio != G[r].size()) {
      finch = 1;
      break;
    }
    ans[r] = 2;
  }
  it = sc.begin();
  for (; it != sc.end(); ++it) {
    int r = (*it);
    for (int j = 0; j < G[r].size(); ++j) {
      int r1 = G[r][j];
      if (sc.find(r1) != sc.end()) {
        finch = 1;
        break;
      }
    }
    int uio = sb.size();
    int kl = sa.size();
    uio += kl;
    if (uio != G[r].size()) {
      finch = 1;
      break;
    }
    ans[r] = 3;
  }
  if (finch) {
    cout << "-1\n";
  } else {
    for (int i = 1; i <= n; ++i) {
      cout << ans[i] << " ";
    }
  }
  return 0;
}
