#include <iostream>
#include <vector>
using namespace std;
vector<int> A[200'001];
int Z[200'001];
void f(int i, int z) {
Z[i] = z;
z = z == 1 ? 2 : 1;
for (int j : A[i]) {
if (!Z[i]) {
f(j,z);
} else if (Z[i] == w) {
cout << "IMPOSSIBLE";
exit(0);
}
}
}
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < m; ++i) {
int a, b;
cin >> a >> b;
A[a].push_back(b);
A[b].push_back(a);
}
for (int i = 0; i < n; ++i) {
if (!Z[i]) f(i, 1);
}
for (int i = 0; i < n; ++i) {
cout << (Z[i] ? "1 " : "2 ");
}
}