after piece devilish mirror hit Kays eye long interested beauty rose now like watch snowflakesonce time find huge snowflake form tree connect acyclic graph consist n node the root tree index 1 Kay interested structure treeAfter research form q query interested the ith query ask find centroid subtree node vi your goal answer queriesSubtree node tree consist node descendant direct in word subtree node v form node u node v present path u rootCentroid tree subtree node erase tree maximum size connect component time small size initial tree subtree