'use strict'

function main(input) {
    const n = input.trim().split(/\n/).
                slice(1)
                .map(str=>str.split(/\s/).map(s=>~~s))
    
    let roots = new Map()
    for(let i = 0; i < n.length; i++){
        roots.set(i+1,[])
    }
    
    n.forEach(root=>{
        roots.set(root[0], [...roots.get(root[0]),root[1]])
        roots.set(root[1], [...roots.get(root[1]),root[0]])
    })
    
    
    let hasMapRooms = [1]
    let roadMap = [...Array(n.length - 1)]
    
    for(let i = 0; i < hasMapRooms.length; i++){
        const nextto = roots.get(hasMapRooms[i])    
        nextto.forEach(n=>{
        if(!roadMap[n - 2] && n > 1){
            roadMap[n - 2] = hasMapRooms[i]
        }
        hasMapRooms = [... new Set([...hasMapRooms,...nextto])]
    })
    }

    if(roadMap.includes(undefined)){
        console.log("No")
    } else {
        console.log("Yes")
        console.log(roadMap.join("\n"))
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
