Gardening

Limits 7s, 512 MB

You are given a tree with NN vertices. Here, a tree is an undirected graph in which any two vertices are connected by exactly one simple path, or equivalently a connected acyclic undirected graph. A tree with NN vertices, contains exactly N1N - 1 undirected edges.

You have to process QQ queries. In each of the query, you will be given 3 positive integers RR, UUand VV. You have to perform the following operations on your tree —

Note that, Each query is independent which means operations in one query does not affect the other queries.

Input

The first line of the input will contain an integer, NN (2N3×105)(2 \leq N \leq 3 \times 10^5) which denotes the number of vertices of the tree.

Each of the next N1N - 1 lines will contain 22 space-separated integers uiu_i and viv_i(1ui,viN)(1 \leq u_i, v_i \leq N), indicating an edge between vertices uiu_i and viv_i. It is guaranteed that the given edges form a tree.

The next line will contain an integer QQ (1Q3×105)(1\leq Q\leq 3\times 10 ^ 5), the number of queries.

Finally, each of the next QQ line will contain 33 integers RiR_i,UiU_i and ViV_i(1Ri,Ui,ViN)(1 \leq R_i, U_i, V_i \leq N) — representing each query.

Output

Print the answer for each query in separate lines.

Samples

InputOutput
5
2 1
3 1
4 3
5 1
4
4 2 1
2 1 2
4 2 1
4 4 1
9
8
9
6
InputOutput
6
1 2
2 3
3 4
4 6
1 5
2
1 5 6
1 5 4
9
9
InputOutput
10
2 1
3 2
4 3
5 3
6 4
7 2
8 4
9 8
10 7
2
1 10 4
9 1 9
27
23