fun main() = ABC168D.main()

object ABC168D {
    fun log(message: Any?) {
        println(message)// TODO: ←消す
    }

    fun main() {
        val (N, M) = readInts()
        val edges = (1..M).flatMap {
            val (A, B) = readInts()
            listOf(A - 1 to B - 1, B - 1 to A - 1)
        }.groupBy { it.first }.mapValues { it.value.map { it.second }.toSet() }

        val dests = (1..N).map { null as Int? }.toMutableList()

        val stack = mutableListOf(0)
        while (stack.isNotEmpty()) {
            val dest = stack.first()
            stack.removeAt(0)
            edges[dest]?.let { tos ->
                tos.forEach { to ->
                    if (dests[to] == null) {
                        dests[to] = dest
                        stack.add(to)
                    }
                }
            }
        }

        val valid = dests.all { it != null }
        println(valid.yesOrNo())
        if(valid){
            val ans = dests.drop(1).map { it?.plus(1) }
            println(ans.joinToString("\n"))
        }
    }


    /*####################################################################################*/

    fun readString() = readLine()!!
    fun readStrings() = readLine()!!.split(" ")
    fun readInt() = readLine()!!.toInt()
    fun readInts() = readLine()!!.split(" ").map { it.toInt() }
    fun readLong() = readLine()!!.toLong()
    fun readLongs() = readLine()!!.split(" ").map { it.toLong() }
    fun readMatrixRows(height: Int) = (1..height).map { readLine()!!.toList() }

    fun Boolean.yesOrNo() = if (this) "Yes" else "No"
    fun Double.toNaturalExpr() = println("%f".format(this))
}