#include<iostream>#include<cmath>#include<cstdio>#include<cstring>#include<algorithm>
using namespace std;
const int maxn=1000005;
int c[maxn],v[maxn],first[maxn],last[maxn],next[maxn];
int n,m,i,t,j,k,l,num,x,y;
bool bz[maxn],bz1;
void lian(intx,inty){
last[++num]=y;next[num]=first[x];first[x]=num;
}
int main(){
freopen("perfect.in","r",stdin);freopen("perfect.out","w",stdout);
scanf("%d%d",&n,&m);
for (i=1;i<=m;i++)
scanf("%d%d",&x,&y),lian(x,y),lian(y,x);
for (l=1;l<=n;l++){
if (bz[l]) continue;
bz[l]=true;c[l]=1;
j=1,v[1]=l;i=0;
while (i<j){
x=v[++i];
for (t=first[x];t;t=next[t])
if (!bz[last[t]]) c[last[t]]=1-c[x],v[++j]=last[t],bz[last[t]]=true;
elseif (c[last[t]]!=1-c[x]){
j=0;
break;
}
}
if (!j){
printf("NO\n");return0;
}
}
printf("YES\n");
for (i=1;i<=n;i++)
printf("%d ",c[i]);
}