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


int n,m;
int* edge[100001];
int edlen[100001]={};
int ans[100001]={};

int que[100001];
int qmax = 100001;
int qs=0,ql=0;

void allc(int a,int b){
  edge[a] = realloc(edge[a],sizeof(int)*(edlen[a]+1));
  if(edge[a]==NULL) exit(2);
  edge[a][edlen[a]++] = b;
}

void enq(int a){
  que[ql]=a;
  ql = (ql+1)%qmax;
}

int deq(void){
  int tmp = que[qs];
  que[qs] = 0;
  qs = (qs+1)%qmax;
  return tmp;
}

int main(){
  scanf("%d%d",&n,&m);
  for(int i=0;i<m;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    allc(a,b);
    allc(b,a);}

  enq(1);
  while(1){
    int tmp = deq();
    if(tmp==0) break;
    for(int i=0;i<edlen[tmp];i++){
      int nexte = edge[tmp][i];
      if(ans[nexte]==0){
	enq(nexte);
	ans[nexte] = tmp;}
    }
  }
  int flag=1;
  for(int i=2;i<=n;i++){
    if(ans[i]==0){
      flag=0; break;}}
  if(flag){
    printf("Yes\n");
    for(int i=2;i<=n;i++){
      printf("%d\n",ans[i]);}}
  else{
    printf("No\n");}
  
  return 0;
}
