#include<stdio.h>

int main(int argc, char *argv[]){

  int n, m;
  scanf("%d %d", &n, &m);

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

  int sign[n+1];
  for(int i=0; i<=n; i++){
    sign[i] = 0;
  }
  sign[1] = 1;

  int room_cnt = 0;
  int no_flag = 0;
  while(1){
    for(int j=0; j<n+1; j++){
      int room;
      if(sign[j]==0){
        continue;
      }else{
        room = j;
      }
      //printf("room=%d\n", room);
      int room_cnt_inc = 0;
      for(int i=0; i<m; i++){
        int ai = a[i];
        int bi = b[i];
        //printf("ai=%d, bi=%d\n", ai, bi);
        if((ai == room) && (sign[bi] == 0)){
          sign[bi] = room;
          room_cnt_inc++;
        }else if((bi == room) && (sign[ai] == 0)){
          sign[ai] = room;
          room_cnt_inc++;
        }
      }
      if(room_cnt_inc == 0){
        no_flag = 1;
        break;
      }else{
        room_cnt += room_cnt_inc;
      }
    }
    //printf("room count:%d\n", room_cnt);
    if(room_cnt >= n-1) break;
    if(no_flag == 1) break;
  }

  if(no_flag == 1){
    printf("No\n");
  }else{
    printf("Yes\n");
    for(int i=2; i<=n; i++){
      //printf("sign[%d]=%d\n", i, sign[i]);
      printf("%d\n", sign[i]);
    }
  }

  return 0;
}
