{"raw_statement":[{"iden":"statement","content":"You are given a tree (a graph with _n_ vertices and _n_ - 1 edges in which it's possible to reach any vertex from any other vertex using only its edges).\n\nA vertex can be destroyed if this vertex has even degree. If you destroy a vertex, all edges connected to it are also deleted.\n\nDestroy all vertices in the given tree or determine that it is impossible."},{"iden":"input","content":"The first line contains integer _n_ (1 ≤ _n_ ≤ 2·105) — number of vertices in a tree.\n\nThe second line contains _n_ integers _p_1, _p_2, ..., _p__n_ (0 ≤ _p__i_ ≤ _n_). If _p__i_ ≠ 0 there is an edge between vertices _i_ and _p__i_. It is guaranteed that the given graph is a tree."},{"iden":"output","content":"If it's possible to destroy all vertices, print \"_YES_\" (without quotes), otherwise print \"_NO_\" (without quotes).\n\nIf it's possible to destroy all vertices, in the next _n_ lines print the indices of the vertices in order you destroy them. If there are multiple correct answers, print any."},{"iden":"examples","content":"Input\n\n5\n0 1 2 1 2\n\nOutput\n\nYES\n1\n2\n3\n5\n4\n\nInput\n\n4\n0 1 2 3\n\nOutput\n\nNO"},{"iden":"note","content":"In the first example at first you have to remove the vertex with index 1 (after that, the edges (1, 2) and (1, 4) are removed), then the vertex with index 2 (and edges (2, 3) and (2, 5) are removed). After that there are no edges in the tree, so you can remove remaining vertices in any order.\n\n<center>![image](https://espresso.codeforces.com/6e12cad71c744a2da8773d51510c1273282d8ab6.png)</center>"}],"translated_statement":[{"iden":"statement","content":"给你一棵树（一个具有 #cf_span[n] 个顶点和 #cf_span[n - 1] 条边的图，其中仅通过其边可以从任意顶点到达任意其他顶点）。\n\n如果一个顶点的度为偶数，则可以销毁该顶点。当你销毁一个顶点时，所有与之相连的边也会被删除。\n\n请销毁给定树中的所有顶点，或确定这是不可能的。\n\n第一行包含整数 #cf_span[n] (#cf_span[1 ≤ n ≤ 2·105]) —— 树中顶点的数量。\n\n第二行包含 #cf_span[n] 个整数 #cf_span[p1, p2, ..., pn] (#cf_span[0 ≤ pi ≤ n])。如果 #cf_span[pi ≠ 0]，则顶点 #cf_span[i] 和 #cf_span[pi] 之间有一条边。保证给定图是一棵树。\n\n如果可以销毁所有顶点，请输出 \"_YES_\"（不含引号），否则输出 \"_NO_\"（不含引号）。\n\n如果可以销毁所有顶点，请在接下来的 #cf_span[n] 行中按销毁顺序输出顶点的索引。如果有多个正确答案，输出任意一个即可。\n\n在第一个示例中，首先必须移除索引为 1 的顶点（之后边 (1, 2) 和 (1, 4) 被删除），然后移除索引为 2 的顶点（边 (2, 3) 和 (2, 5) 也被删除）。此后树中不再有边，因此你可以按任意顺序移除剩余顶点。\n\n"},{"iden":"input","content":"第一行包含整数 #cf_span[n] (#cf_span[1 ≤ n ≤ 2·105]) —— 树中顶点的数量。第二行包含 #cf_span[n] 个整数 #cf_span[p1, p2, ..., pn] (#cf_span[0 ≤ pi ≤ n])。如果 #cf_span[pi ≠ 0]，则顶点 #cf_span[i] 和 #cf_span[pi] 之间有一条边。保证给定图是一棵树。"},{"iden":"output","content":"如果可以销毁所有顶点，请输出 \"_YES_\"（不含引号），否则输出 \"_NO_\"（不含引号）。如果可以销毁所有顶点，请在接下来的 #cf_span[n] 行中按销毁顺序输出顶点的索引。如果有多个正确答案，输出任意一个即可。"},{"iden":"examples","content":"输入50 1 2 1 2输出YES12354输入40 1 2 3输出NO"},{"iden":"note","content":"在第一个示例中，首先必须移除索引为 1 的顶点（之后边 (1, 2) 和 (1, 4) 被删除），然后移除索引为 2 的顶点（边 (2, 3) 和 (2, 5) 也被删除）。此后树中不再有边，因此你可以按任意顺序移除剩余顶点。  "}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of vertices in a tree.  \nLet $ G = (V, E) $ be a tree with $ V = \\{1, 2, \\dots, n\\} $ and $ |E| = n - 1 $.  \nLet $ p = (p_1, p_2, \\dots, p_n) $ be a list where $ p_i \\in \\{0\\} \\cup V $, and for each $ i \\in V $, if $ p_i \\ne 0 $, then $ \\{i, p_i\\} \\in E $.  \nLet $ \\deg(v) $ denote the degree of vertex $ v \\in V $ in the current graph.\n\n**Constraints**  \n1. $ 1 \\le n \\le 2 \\cdot 10^5 $  \n2. The graph $ G $ is a tree (connected, acyclic, undirected).  \n3. $ p_i = 0 $ iff vertex $ i $ has no parent in the input encoding (i.e., $ i $ is not connected to any vertex with smaller index in the encoding; but the graph is undirected and tree-structured).  \n4. The adjacency structure defined by $ p $ forms a valid tree.\n\n**Objective**  \nDetermine whether there exists an ordering $ v_1, v_2, \\dots, v_n $ of $ V $ such that at the time of destruction of $ v_k $, $ \\deg(v_k) $ is even.  \nUpon destruction of $ v_k $, all edges incident to $ v_k $ are removed, reducing the degree of its neighbors by 1.  \n\nIf such an ordering exists:  \n- Output \"YES\", followed by the sequence $ v_1, v_2, \\dots, v_n $.  \n- Otherwise, output \"NO\".","simple_statement":null,"has_page_source":false}