SP14943 DRTREE - Dynamically-Rooted Tree
Description
You are given a rooted tree with N nodes, numbered from 1 to N. Initially node 1 is the root. Each node i has a weight W\[i\]. You have to perform two types of operations:
**"S a"** - Find the sum of weights of node **a**'s sub-tree nodes (including node **a**).
**"R a"** - Change root of the tree to **a**.
Input Format
N/A
Output Format
N/A