#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const long long INF = 1e18;
const int MAXN = 3e5 + 1;
const long long mod = 1e9 + 7;
int c[MAXN];
vector<int> g[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  set<int> v1, v2, v3;
  for (int i = 1; i <= n; i++) v1.insert(i);
  for (auto &i : g[1]) v1.erase(i), v2.insert(i);
  if (v2.empty()) {
    cout << -1;
    return 0;
  }
  int t = *v2.begin();
  for (auto &i : g[t])
    if (v2.count(i)) v2.erase(i), v3.insert(i);
  if (v3.empty()) {
    cout << -1;
    return 0;
  }
  for (auto &i : v1) {
    for (auto &j : g[i]) {
      if (g[i].size() != n - v1.size() or v1.count(j)) {
        cout << -1;
        return 0;
      }
    }
    c[i] = 1;
  }
  for (auto &i : v2) {
    for (auto &j : g[i]) {
      if (g[i].size() != n - v2.size() or v2.count(j)) {
        cout << -1;
        return 0;
      }
    }
    c[i] = 2;
  }
  for (auto &i : v3) {
    for (auto &j : g[i]) {
      if (g[i].size() != n - v3.size() or v3.count(j)) {
        cout << -1;
        return 0;
      }
    }
    c[i] = 3;
  }
  for (int i = 1; i <= n; i++) cout << c[i] << ' ';
  return 0;
}
