#include <stdio.h>
#include <string.h>
#include <math.h>

int path[200200][200200];
int exist = 0;
int kai;
int min = 200200;
int ans[200200],no[200200];
int N,M;
int cycle(int node){
	//printf("node:%ld\n",node);
	int ret;
	if(node ==1){
		if(min>kai)min=kai;
		//printf("<<%ld>>\n",min);
		exist = 1;
		kai = 0;
		return 0;
	}
	int i;
	kai++;
	if(no[node]==1){
		//kai=0;
		return 1;
	}
	no[node]=1;
	
	//printf("kai:%ld\n",kai);
	for(i=1;i<=M;i++){
		if(path[node][i]){
			//printf("-->%ld\n",i);
			ret=cycle(i);
			if(ret==0){
				//printf("don\n");
				return 0;
			}
		}
	}

	return 1;
	
}
int main(){
	

	int i;
	scanf("%d%d",&N,&M);
	
	for(i=0;i<M;i++){
		int t,s;
		scanf("%d%d",&t,&s);
		path[t][s]=1;
		path[s][t]=1;
	}
	
	for(i=2;i<=N;i++){
		cycle(i);
		//printf("(%ld)%ld %ld\n",i,kai,min);
		ans[i-1]=min;
		min = 200200;
		int j;
		for(j=0;j<=N;j++)no[j]=0;
	}
	if(exist){
		printf("Yes\n");
		for(i=1;i<N;i++)printf("%d\n",ans[i]);
		
	}else {
		printf("No\n");
	}
	
	
	
		
	return 0;
}
