all_ = set([i for i in range(1,N)])
child = [[] for _ in range(N)]
ans = [[] for _ in range(N)]
for ab in AB:
    child[ab[0]-1].append(ab[1]-1)
    child[ab[1]-1].append(ab[0]-1)
child = list(map(set,child))
check = [0]
while len(all_ ) != 0:
    checkk = []
    for c in check:
        print(child[c])
        print(all_)
        a = list(child[c] & all_)
        print(a)
        ans[c] = a
        checkk += a
        all_ = all_ - child[c]
    check = list(set(checkk))
anss = [[] for i in range(N)]
for i in range(N):
    for a in ans[i]:
        anss[a] = i
print('Yes')
for a in anss[1:]:
    print(a + 1)