"use strict"
const tan = (x) => { return Math.tan(x); }
function main(arg) {
    // let [N,M] = arg.trim().split("\n")[0].split(" ").map(Number)
    let data = arg.trim().split("\n").map(e => e.split(" ").map(Number))
    let [N, M] = data.shift()
    let list = {}
    for (let i = 0; i < data.length; i++) {
        let [l,r] = data[i]
        if (!Array.isArray(list[l])) {
            list[l] = []
        }
        if (!Array.isArray(list[r])) {
            list[r] = []
        }
        list[l].push(r)
        list[r].push(l)
    }
    // console.log(JSON.stringify(list))

    function solve(key, history) {
        if (list[key].includes(1)) {
            history.push(key)
            return history
        } else {
            // console.log(history)
            history.push(key)
            let ans = null
            for (let i = 0; i < list[key].length; i++) {
                let id = list[key][i]
                if (history.includes(id)) {
                    continue
                }
                let tmp = solve(id, history.concat())
                // console.log(tmp)
                if (tmp.length === 0) {
                    continue
                }
                if (ans === null) {
                    ans = tmp
                }
                if (ans.length > tmp.length) {
                    ans = tmp
                }
            }
            // console.log(ans)
            return ans
        }
    }
    let ans_list = []
    for (let i = 2; i <= N; i++) {
        let start = String(i)
        let history = []
        let ans = solve(start, history)
        if (ans.length === 0) {
            console.log('No')
            return
        }
        // let tmp = ans.length
        ans_list.push(ans.length)
        // console.log(ans)
        // console.log("---")
    }
    console.log('Yes')
    for (let i = 0; i < ans_list.length; i++) {
        console.log(ans_list[i])
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


