#include<bits/stdc++.h>
using namespace std;
mt19937 rnd(time(0));
int ok[100005];
vector<int>p[200005];
int n,m;
const int M = 1000000;
int ans = 0;
signed main(){
cin >> n >> m;
for(int i = 1;i<=m;i++){
int a,b;cin >>a >> b;
p[a].push_back(b),p[b].push_back(a);
}
for(int i = 0;i<M;i++){
// if(ans>=(m+1)/2)break;
int now = rnd()%n+1,tt = 0,ww;
for(int x:p[now])tt+=(ok[x]==ok[now]),ww+=(ok[x]!=ok[now]);
if(tt>ww){
ok[now]^=1;ans = ans-ww+tt;
}
}
//cout << ans << endl;
for(int i = 1;i<=n;i++)cout << ok[i] << ' ';cout<< endl;
return 0;
}/*
4 6
1 2
1 3
1 4
2 3
2 4
3 4
*/