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]
    while (s.length) {
        var r = []
        for (var i = 0; i < M; i++) {
            if (!A[i]) break
            if (s.indexOf(A[i]) !== -1) {
                dp[B[i] - 1] = dp[B[i] - 1] || A[i]
                r.push(B[i])
                A.splice(i, 1)
                B.splice(i, 1)
                i--
            } else if (s.indexOf(B[i]) !== -1) {
                dp[A[i] - 1] = dp[A[i] - 1] || B[i]
                r.push(A[i])
                A.splice(i, 1)
                B.splice(i, 1)
                i--
            }
        }
        s = [...r]
    }
 
    dp[0] = -1
    if (dp.indexOf(0) === -1) {
        dp[0] = 'Yes'
    } else {
        dp[0] = 'No'
    }
    dp.forEach(val => {
        console.log(val)
    })
 
})(input)