Shera has been recently placed in Flipkart, an e-commerce company. His manager gave him a task to complete.
Task: Shera is given a tree hierarchy of items, their categories, sub-categories of the company such that it forms a tree like structure. Each one of them is having a key number from 1 to 'n'(count of all of them). But the key numbers are unordered.
As Diwali is round the corner so Shera has been asked to design a program that introduces a discount 'd' on any category,sub-category or product which will help in easily applying discounts, to the company.
He also needs to tell the discount on a particular product when queried, this will help process user requests about discount.
Since Shera is new to the company and not so good in maths, so you need to help him complete this task so he can impress his manager.
Input: You are given 'n' - the products,category and sub-categories key value limit. This is followed by n-1 lines containing (u,v) which represents a link between key(u) and key(v), representing the tree structure. Next line contains 'q' - number of queries. Next 'q' lines contains queries of the form:
Output: For each query of type - "Q x", output the discount on product x at that particular instant.
Note:
Constraints:
1<=n,q<=100000
1<=u,v<=n
0<=y<=60
'x' with Q will only be the key of products.
'x' with U can be any key from [1,n].