There are multiple test cases (no more than 50).
For each case, the first three lines describe the first tree. The first line only contains an integer N, the number of the nodes.
The second line contains N-1 integers, the i-th number is the father of node i+1.
The third line contains N integers, the i-th number is the weight of node i.
Next three lines have the same format, describing the second tree.
Next line only contains an integer Q.
Next Q lines, each line contains four integers u1,v1,u2,v2.
$1 \leq N1, N2 \leq 100,000$.
For each tree, $1 \leq P_i < i, \text{where }i > 1$ and $P_i$ is the father of i.
For each node, $0 \leq \text{weight} \leq 1,000,000,000$.
$1 \leq Q \leq 50,000$.
$1 \leq u_1, v_1 \leq N_1, 1 \leq u_2, v_2 \leq N_2$.
Number of cases with $max(N1,N2,Q) \geq 1,000$ is no more than 5.
Huge data. Fast I/O may be needed.