You are given a tree comprising n nodes numbered from 1 to n. You have to answer q queries each consisting of three numbers – r, d1 and d2.
For each query, print the number of nodes whose depth is between d1 and d2 (inclusive) if the tree is rooted at node r. The depth of root node itself is 0, the depth of all its children is 1 and so on.
Input format
First line: n (the number of nodes) and q (the number of queries)
Next n−1 lines: ui and videnoting an edge between the nodes ui and vi.The next q lines consist of three integers r , d1 and d2 .
Output format
For each query, print the answer in a new line.
input Constraints
1≤n≤1000001≤q≤1500000≤d1≤d2≤n1≤r≤n
For node 1, there are 4 nodes whose depth is between 0 and 2 (1,2,3 and 4). For node 2 there are 3 nodes whose depth is between 0 and 1 (1,2 and 4).