You are given an undirected tree with N nodes and the tree is rooted at node 1. Each node has an integer value A[i] associated with it represented by an array A of size N.
Also, you are given Q queries of the following type:
Input format
Output format
Print Q space-separated integers denoting the answer of queries.
Constraints
1≤N≤4×1041≤Q≤1051≤A[i]≤106