AdvancedRating 1700
Centre of a Tree
A centre of a tree is a node whose greatest distance to any other node is as small as possible. Print all centres in increasing order (there are one or two).
Input
n; then n − 1 lines 'u v'.
Output
One line.
Sample 1
Input
4 1 2 1 3 1 4
Output
1
Sample 2
Input
6 3 1 3 2 3 4 4 5 5 6
Output
4
Output appears here