Emerging Tree

한 번에 하나씩 추가되어 마지막에 루트 있는 트리가 되는 간선들이 주어질 때, 각 단계의 도달 가능 집합이 모두 연속된 정수 구간이 되도록 번호를 매긴다.

어려움8트리DFS동적 계획법아직 제출이 없습니다시간 제한3초메모리 제한512 MB

문제

Consider a set V=1,,nV = \\{1, \ldots, n\\} of nn vertices, and a sequence of directed edges e_1,,e_n1e\_1, \ldots, e\_{n - 1}. Let G_0,,G_n1G\_0, \ldots, G\_{n - 1} be a sequence of graphs such that G_0G\_0 is empty, and G_iG\_i is obtained by introducing the edge e_ie\_i into G_i1G\_{i - 1} for each i=1,,n1i = 1, \ldots, n - 1. It is guaranteed that G_n1G\_{n - 1} is a rooted tree with all edges directed away from the root.

Your task is to find a suitable permutation p_1,,p_np\_1, \ldots, p\_n of the set 1,,n\\{1, \ldots, n\\}. Let S\_i(v) = \\{p\_u \mid u can be reached from vv in G\_i\\}. A permutation p_1,,p_np\_1, \ldots, p\_n is called suitable if for any i0,,n1i \in \\{0, \ldots, n - 1\\} and for any vVv \in V we have that S_i(v)S\_i(v) consists of consecutive numbers (that is, S_i(v)=l,l+1,,rS\_i(v) = \\{l, l + 1, \ldots, r\\} for some numbers ll and rr).

입력

The first line contains a single integer nn (2n1062 \leq n \leq 10^6).

The next n1n - 1 lines describe the edges e_1,,e_n1e\_1, \ldots, e\_{n - 1}. The ii-th of these lines contains two integers u_iu\_i and v_iv\_i --- indices of the source and the target vertices of the edge e_ie\_i (1u_i,v_in1 \le u\_i, v\_i \le n).

It is guaranteed that adding all n1n - 1 edges results in a rooted tree with edges directed away from the root.

출력

If there is no suitable permutation, print the only word "No" in the only line.

Otherwise, print "Yes" on the first line. On the second line print nn integers p_1,,p_np\_1, \ldots, p\_n describing any suitable permutation.