#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int n,m;
int ans[100001];
int tmp[100001];
int scan_tmp[100001];
int scan_tmp2[100001];
int main(void)
{
  scanf("%d%d",&n,&m);
  for(int i=0;i<=n;i++){
    ans[i]=0;
    tmp[i]=0;
    scan_tmp[i]=0;
    scan_tmp2[i]=0;
  }
  
  int a[m+1],b[m+1];
  for(int i=0;i<m;i++){
    scanf("%d%d",&a[i],&b[i]);
    scan_tmp[a[i]]++;
    scan_tmp[b[i]]++;
  }

  int **class;
  class=malloc(sizeof(int *)*(n+2));
  for(int i=1;i<=n+1;i++){
    class[i]=(int *)malloc(sizeof(int *)*(scan_tmp[i]+1));
  }
  for(int j=0;j<m;j++){
    scan_tmp2[a[j]]++;
    scan_tmp2[b[j]]++;
    class[a[j]][scan_tmp2[a[j]]]=b[j];
    class[b[j]][scan_tmp2[b[j]]]=a[j];
  }
  
  tmp[1]=1;
  int tmp_new[n],start=0,end=0,s=0,e=0;
  tmp_new[0]=1;
  while(1){
    for(int i=start;i<=end;i++){
      for(int j=1;j<=scan_tmp[tmp_new[i]];j++){
        if(tmp[class[tmp_new[i]][j]]==0){
          ans[class[tmp_new[i]][j]]=tmp_new[i];
          tmp[class[tmp_new[i]][j]]=1;
          tmp_new[e+1]=class[tmp_new[i]][j];
          e++;
        }
      }
    }
    if(e==end) break;
    start=end+1;
    end=e;
  }
  
  for(int i=2;i<=n;i++){
    if(ans[i]==0){
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  for(int i=2;i<=n;i++){    
    printf("%d\n",ans[i]);
  }
  
  return 0;
}