var a = []

function Main(input) {
    input = input.trim();
    input = input.split("\n").map(e=>e.split(" ").map(f=>parseInt(f)))
    
    input = input.slice(1,input.length)

    input.forEach(e=>{
        if(!a[e[0]-1])a[e[0]-1] = {child:[]}        
        if(!a[e[1]-1])a[e[1]-1] = {child:[]}                            
        a[e[0]-1].child.push(e[1])
        a[e[1]-1].child.push(e[0])
    })
    
    console.log('Yes');

    for(var i=2;i<=a.length;i++){
        console.log(saiki(i));    
    }        
}

Main(require("fs").readFileSync("/dev/stdin", "utf8")); 


function saiki(num){    

    if(a[num-1].child.indexOf(1) != -1){
        return 1;
    }else{
        var min = 1000000000;
        var aa = 1000000000;

        for(var i = 0;i<a[num-1].child.length;i++){
            var e = a[num-1].child[i];
            if(min > saiki2(e,0,[])){
                min = saiki2(e,0,[]);
                aa = e;
                if(min == 0) break;
            }
        }        
        return aa;
    }
}

function saiki2(num,count,nums){    
    nums.push(num);

    if(a[num-1].child.indexOf(1)!= -1){
        return count;
    }else{
        a[num-1].child.forEach(e=>{
            if(nums.indexOf(e)==-1){
                saiki2(e,count+1,nums);
            }
        })
    }    
}