function main(lines) {
  const [N, M] = splitN(lines[0]);

  const map = Array(N+1).fill(0).map(() => []);
  for (let i = 1; i <= M; i++) {
    const [a, b] = splitN(lines[i]);
    map[a].push(b);
    map[b].push(a);
  }
  const res = [null];
  for (let current = [1]; true; ) {
    const next = [];
    current.forEach(c => {
      map[c].forEach(n => {
        if (res[n-1] !== undefined) return;
        res[n-1] = c;
        next.push(n);
      });
    });
    if (!next.length) break;
    current = next;
  }
  
  if (res.filter(i => i !== undefined).length === N) {
    res[0] = 'Yes';
    console.log( res.join('\n') );
  } else {
    console.log('No');
  }
}


main( require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n") );



function splitN(s) {
  return s.split(' ').map(Number);
}