The first query asks for a centroid of the whole tree — this is node 3 . If we delete node 3 the tree will split in four components, two of size 1 and two of size 2 .
The subtree of the second node consists of this node only, so the answer is 2 .
Node 3 is centroid of its own subtree.
The centroids of the subtree of the node 5 are nodes 5 and 6 — both answers are considered correct.
http://codeforces.com/problemset/problem/685/B