You are given a tree with n nodes, numbered from 1 to n. Every edge has one of n colors. A path in the tree is a rainbow path if every two adjacent edges on it have different colors. A node v is good if every simple path that has v as one of its endpoints is a rainbow path.
Find all the good nodes of the given tree.
A simple path is a path that repeats no vertex and no edge.
Input
The first line contains one integer n (1≤n≤50000).
Each of the next n−1 lines contains three integers ai, bi, and ci separated by spaces (1≤ai,bi,ci≤n, ai=bi). They describe an edge of color ci that connects node ai and node bi.
The given edges always form a tree.
Output
On the first line, print k, the number of good nodes.
On each of the next k lines, print the index of one good node, in increasing order.
Hint
The rainbow condition applies only to consecutive edges of a path. On a path v1,v2,v3,v4 the edges (v1,v2) and (v3,v4) may share a color, because they are not adjacent. A path with at most one edge has no adjacent pair of edges, so it is always a rainbow path.