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

typedef struct tagListNode {
	int s_time;	/*1からそこに行くのにどれだけかかるか*/
	int b_room;	/*1へ行くのに通る部屋*/
} ROOM;

int main(void){
	int N,M;
	int *A,*B;
	ROOM *room;
	int i,j,flag;
	char str[10000000];
 
	fgets(str, sizeof(str), stdin);
	N=atoi(strtok(str," "));
	M=atoi(strtok(NULL," "));

	A=(int*)calloc(M,sizeof(int));
	B=(int*)calloc(M,sizeof(int));
	room=(ROOM*)calloc(N,sizeof(ROOM));

	for(i=0;i<M;i++){
		fgets(str, sizeof(str), stdin);
		A[i]=atoi(strtok(str," "));
		B[i]=atoi(strtok(NULL," "));		
	}

	room[0].s_time=0;
	room[0].b_room=0;	
	for(i=1;i<N;i++){
		room[i].s_time=2*M;
		room[i].b_room=i;
	}

	for(i=0;i<M;i++){/*ループ回数*/
		for(j=0;j<M;j++){
			int a=A[j]-1;
			int b=B[j]-1;/*部屋番号と配列の事情*/

			if( room[a].s_time < room[b].s_time){/*AがBより近かったら*/
				room[b].s_time=room[a].s_time+1;
				room[b].b_room=a;
			}else if( room[a].s_time > room[b].s_time){/*BがAより近かったら*/
				room[a].s_time=room[b].s_time+1;
				room[a].b_room=b;
			}
		}
	}

	flag=0;
	for(i=0;i<N;i++){
		if(room[i].s_time==2*M) flag=1;
	}

	if(flag==1){
		printf("No\n");
	}else{
		printf("Yes\n");
		for(i=1;i<N;i++){
			printf("%d\n",(room[i].b_room+1));
		}
	}

	free(A);
	free(B);
	free(room);

	return 0;
}