const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {
    const rows = input.split('\n')
    const N = parseInt(rows[0].split(' ')[0], 10)
    const M = parseInt(rows[0].split(' ')[1], 10)
    const A = []
    const B = []
    for (var i = 0; i < M; i++) {
        A[i] = parseInt(rows[i + 1].split(' ')[0], 10)
        B[i] = parseInt(rows[i + 1].split(' ')[1], 10)
    }

    const dp = [...Array(N).fill(0)]

    let s = [1]
    var n = 0
    while (n = s.pop()) {
        for (var i = 0; i < M; i++) {
            if (!A[i]) break
            if (A[i] === n) {
                dp[B[i] - 1] = dp[B[i] - 1] || A[i]
                s.push(B[i])
                A.splice(i, 1)
                B.splice(i, 1)
                i--
            } else if (B[i] === n) {
                dp[A[i] - 1] = dp[A[i] - 1] || B[i]
                s.push(A[i])
                A.splice(i, 1)
                B.splice(i, 1)
                i--
            }
        }
    }

    dp[0] = -1
    if (dp.indexOf(0) === -1) {
        dp[0] = 'Yes'
        dp.forEach(val => {
            console.log(val)
        })
    } else {
        console.log('No')
    }

})(input)
