import java.util.Scanner

import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {

    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val m = sc.nextInt()

    val ab = Set.fill(m)(Set(sc.nextInt(), sc.nextInt()))

    val history = mutable.Set.empty[Int]
    val store = mutable.ArrayBuffer.fill(n)(0)
    val stack = mutable.Stack(1)

    def l(p: Int): Unit = {
      history += p
      ab.filter(_.contains(p)).flatten.filter(_ != p).filter(!history.contains(_)).foreach { i =>
        stack.push(i)
        if (store(i - 1) == 0) store(i - 1) = p
      }
      if (stack.nonEmpty) l(stack.pop())
    }

    l(stack.pop())

    println("Yes")
    store.tail.foreach(println)

  }

}
