{"raw_statement":[{"iden":"problem statement","content":"Given is a tree with $N$ vertices numbered $1$ through $N$. The $i$\\-th edge connects Vertex $A_i$ and Vertex $B_i$. Vertex $i$ is painted in color $C_i$ (in this problem, colors are represented as integers).\nVertex $x$ is said to be **good** when the shortest path from Vertex $1$ to Vertex $x$ does not contain a vertex painted in the same color as Vertex $x$, except Vertex $x$ itself.\nFind all good vertices."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 10^5$\n*   $1 \\leq C_i \\leq 10^5$\n*   $1 \\leq A_i,B_i \\leq N$\n*   The given graph is a tree.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$C_1$ $\\ldots$ $C_N$\n$A_1$ $B_1$\n$\\vdots$\n$A_{N-1}$ $B_{N-1}$"},{"iden":"sample input 1","content":"6\n2 7 1 8 2 8\n1 2\n3 6\n3 2\n4 3\n2 5"},{"iden":"sample output 1","content":"1\n2\n3\n4\n6\n\nFor example, the shortest path from Vertex $1$ to Vertex $6$ contains Vertices $1,2,3,6$. Among them, only Vertex $6$ itself is painted in the same color as Vertex $6$, so it is a good vertex.  \nOn the other hand, the shortest path from Vertex $1$ to Vertex $5$ contains Vertices $1,2,5$, and Vertex $1$ is painted in the same color as Vertex $5$, so Vertex $5$ is not a good vertex."},{"iden":"sample input 2","content":"10\n3 1 4 1 5 9 2 6 5 3\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10"},{"iden":"sample output 2","content":"1\n2\n3\n5\n6\n7\n8"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}