from collections import deque n = int(input()) g = [[] for _ in range(n)] deg = [0 for _ in range(n)] for i in range(n): a, b = map(int, input().split()) a -= 1 b -= 1 g[a].append((b, i)) g[b].append((a, i)) deg[a] += 1 deg[b] += 1 used = [False for _ in range(n)] ans = [None for _ in range(n)] dq = deque() for u in range(n): if len(g[u]) == 0: print("No") exit() elif len(g[u]) == 1: used[u] = True dq.append(u) while len(dq) > 0: cur = dq.popleft() for nxt, e in g[cur]: if not ans[e] is None: continue deg[nxt] -= 1 ans[e] = cur + 1 if deg[nxt] == 1: used[nxt] = True dq.append(nxt) for src in range(n): if used[src]: continue dq.append(src) while len(dq) > 0: cur = dq.popleft() for nxt, e in g[cur]: if not ans[e] is None: continue if used[nxt]: continue ans[e] = nxt + 1 used[nxt] = True dq.append(nxt) print("Yes") print(*ans, sep="\n")