Given a tree with vertices numbered through . The -th edge connects Vertex and Vertex . Vertex is painted in color (in this problem, colors are represented as integers).
Vertex is said to be good when the shortest path from Vertex to Vertex does not contain a vertex painted in the same color as Vertex , except for Vertex itself.
Find all the good vertices.
The first line contains the number of vertices . The second line contains colors . Each of the next lines contains two integers and .
Print all good vertices as integers, in ascending order. Print each number on a separate line.