#include
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define f first
#define s second
int main()
{
ios_base::sync_with_stdio(false);
cout.tie(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vector graph[n+5];
for(int i = 0; i < m; i++){
int a, b;
cin >> a >> b;
graph[a-1].pb(b-1);
graph[b-1].pb(a-1);
}
vector visited(n, false);
vector col(n, -1);
for(int i = 0; i < n; i++){
if(col[i] != -1) continue;
visited[i] = true;
col[i] = 1;
queue q;
q.push(i);
while(!q.empty()){
int c = q.front(); q.pop();
for(int j = 0; j < (int) graph[c].size(); j++){
int z = graph[c][j];
if(col[c] != -1 and col[z] != -1 and col[c] == col[z]) {
cout << "IMPOSSIBLE" << endl;
return 0;
}
if(visited[z]) continue;
visited[z] = true;
if(col[z] == -1){
if(col[c] == 1) col[z] = 2;
if(col[c] == 2) col[z] = 1;
q.push(z);
}else {
if(col[c] == col[z]){
cout << "IMPOSSIBLE" << endl;
return 0;
}
}
}
}
}
for(int i = 0; i < n; i++){
cout << col[i] << " ";
}
return 0;
}