You are given an undirected tree with N nodes rooted at node 1. Every node has a value A[i] assigned to it. You are required to answer Q queries of the following type:
Determine the required answer for Q queries.
Note
Input format
Output format
For each test case, print Q space-separated integers denoting the sum of node values present in the subtree rooted at node X after the swap operation is performed. Print the output for each test case in a new line.
Constraints
1≤T≤101≤N,Q≤1051≤A[i]≤1091≤U,V,X≤N
For first test case
For second test case