Center of the tree#632

Center of the tree

1 second
128 megabytes
Medium (≈1350)

Tree is given. Find its vertices for which the maximum of the distances to the remaining vertices of the tree will be minimal.

Input

First line contains number of vertices \:(1 \le n \le 30000) in the tree. The other n - 1 lines describe the tree. Line contains vertex number — the parent of the vertex . Vertex with number is a root of the tree.

Output

Print the numbers of all the required vertices in ascending order.

Examples

Example 1

Loading
Loading