#include <stdio.h>
#include <stdlib.h>

long road[200002][2];
long N;
long M;


long ans[100001];
int flag[100001];

int main()
{
	//変数宣言
	long i,j;
	long next;
	int can=0;
	
	scanf("%ld %ld",&N,&M);
	
	for(i=0;i<M;i++){
		scanf("%ld %ld",&road[i][0],&road[i][1]);
	}
	for(i=1;i<=N;i++)
	{
		ans[i] = -1;
		flag[i] = 0;
	}
	
	flag[1]=1;
	
	for(i=1;i<=N;i++)
	{
		for(j=1;j<=N;j++)
		{
			if(flag[j]==1)
			{
				next = j;
				flag[j] = -1;
				
				printf("next = %ld\n",next);
				break;
			}
		}
		
		
		for(j=0;j<M;j++)
		{
			if(road[j][0] == next)
			{
				if(ans[road[j][1]] == -1){
					ans[road[j][1]] = next;
					flag[road[j][1]] = 1;
				}
			}
			if(road[j][1] == next)
			{
				if(ans[road[j][0]] == -1){
					ans[road[j][0]] = next;
					flag[road[j][0]] = 1;
				}
			}
		}
	}
	
	
	for(i=1;i<=N;i++){
		if(ans[i] == -1)
		{
			can = -1;
			break;
		}
	}
	
	if(can == 0)
	{
		printf("Yes\n");
		for(i=2;i<=N;i++)
		{
			printf("%ld\n",ans[i]);
		}
	}else
	{
		printf("No\n");
	}
	
	
	return 0;
}