#include<bits/stdc++.h>
using namespace std;
int n,m,a[20],b[20][20];
bool ok(int dep)
{
for(int i=1;i<dep;i++)
{
if(b[i][dep]==1&&a[i]==a[dep])
return false;
}
return true;
}
void dg(int dep)
{
if(dep>n)
{
for(int i=1;i<=n;i++)
cout<<a[i]<<endl;
exit(0);
}
else
{
for(int i=1;i<=4;i++)
{
a[dep]=i;
if(ok(dep)) dg(dep+1);
}
}
}
int main()
{
int x,y;
cin>>n>>m;
for(int i=1;i<=m;i++)
{
cin>>x>>y;
b[x][y]=1;
b[y][x]=1;
}
dg(1);
return 0;
}