from sys import stdin n, *indata = map(int, stdin.read().split()) remained = [0 for i in range(n+1)] g = [[] for i in range(n+1)] offset = 0 for i in range(n): s, t = indata[offset + 2*i],indata[offset + 2*i+1] g[s].append((t,i)) g[t].append((s,i)) remained[s] += 1 remained[t] += 1 que = [] for i in range(1,n+1): if remained[i] == 0: print("No") exit() if remained[i] == 1: que.append(i) used = [False for i in range(n)] ans = [0 for i in range(n)] check = [False for i in range(n+1)] while que: now = que.pop() check[now] = True if remained[now] == 0: print("No") exit() for i, ind in g[now]: if not used[ind]: used[ind] = True ans[ind] = now remained[i] -= 1 if remained[i] == 1: que.append(i) break for i in range(1,n+1): if not check[i]: que.append(i) while que: now = que.pop() check[now] = True if remained[now] == 0: print("No") exit() for i, ind in g[now]: if not used[ind]: used[ind] = True ans[ind] = now remained[i] -= 1 if remained[i] == 1: que.append(i) break print("Yes") for i in range(n): print("{}".format(ans[i]))