{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eTree is given. Find its vertices for which the maximum of the distances to the remaining vertices of the tree will be minimal.\u003c/p\u003e\n\n\u003ch2\u003eInput\u003c/h2\u003e\n\u003cp\u003eFirst line contains number of vertices $\\:(1 \\le n \\le 30000)$ in the tree. The other $n - 1$ lines describe the tree. Line $i$ contains vertex number --- the parent of the vertex $i$. Vertex with number $1$ is a root of the tree.\u003c/p\u003e\n\n\u003ch2\u003eOutput\u003c/h2\u003e\nPrint the numbers of all the required vertices in ascending order."}},{"title":"Example","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e9\n1\n2\n2\n4\n4\n3\n3\n8\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}