#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int col[maxn];
map<int, bool> adj[maxn];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    adj[u][v];
    adj[v][u];
  }
  int cur = 1;
  for (int t = 1; t <= 3; t++) {
    while (cur <= n && col[cur]) cur++;
    if (cur > n) {
      printf("-1");
      return 0;
    }
    vector<int> candidate;
    candidate.push_back(cur);
    for (int i = cur + 1; i <= n; i++) {
      if (!adj[cur].count(i)) candidate.push_back(i);
    }
    bool ok = true;
    for (int j = 1; j < candidate.size(); j++) {
      int prev = candidate[j - 1];
      int me = candidate[j];
      if (adj[prev] != adj[me]) ok = false;
    }
    if (!ok) {
      printf("-1");
      return 0;
    }
    for (int x : candidate) col[x] = t;
  }
  for (int i = 1; i <= n; i++)
    if (col[i] == 0) {
      printf("-1");
      return 0;
    }
  for (int i = 1; i <= n; i++) printf("%d ", col[i]);
}
