#include <bits/stdc++.h>
using namespace std;
struct node {
  int uid;
  basic_string<int> str;
} e[100005];
int deg[100005], col[100005], num[3];
int read() {
  int A;
  bool K;
  char C;
  C = A = K = 0;
  while (C < '0' || C > '9') K |= C == '-', C = getchar();
  while (C > '/' && C < ':') A = (A << 3) + (A << 1) + (C ^ 48), C = getchar();
  return (K ? -A : A);
}
inline bool cmp(node _, node __) { return _.str < __.str; }
int main() {
  int n, m, i, a, b, cnt = 0;
  n = read(), m = read();
  for (i = 1; i <= (m); i++) {
    a = read(), b = read();
    e[a].str += b;
    e[b].str += a;
    deg[a]++;
    deg[b]++;
  }
  for (i = 1; i <= (n); i++)
    sort(e[i].str.begin(), e[i].str.end()), e[i].uid = i;
  sort(e + 1, e + n + 1, cmp);
  for (i = 2; i <= (n); i++)
    if (e[i].str == e[i - 1].str)
      col[e[i].uid] = col[e[i - 1].uid];
    else
      col[e[i].uid] = ++cnt;
  if (cnt != 2) printf("-1"), exit(0);
  for (i = 1; i <= (n); i++) num[col[i]]++;
  for (i = 1; i <= (n); i++)
    if (deg[i] != n - num[col[i]]) printf("-1"), exit(0);
  for (i = 1; i <= (n); i++) printf("%d ", col[i] + 1);
  return 0;
}
