There are several test cases.
The first line contains an integer
T(
1≤T≤8), denoting the number of test cases. Then follow all the test cases.
For each test case, the first line contains an integer
n(1≤n≤105), denoting the number of nodes.
The second line contains
nintegers, where the
i-th intger is
coli(1≤coli≤n), denoting the color of node
iat the beginning.
The third line contains
nintegers, where the
i-th intger is
vali(0≤vali<220), denoting the weight of node
iat the beginning.
The next
(n−1)lines describe the tree, where each line contains two integers
uand
v(1≤u,v≤n), representing an edge connecting node
uand node
v.
The next line contains an integer
q(0≤q≤105), denoting the number of operations.
The next
qlines describe these operations in chronological order of occurrence, where each line contains three integers such that
● if the first integer is
1, then the following two integers are
xand
v(1≤x≤n,0≤v<220), representing an operation of the first type, or
● otherwise the first integer is
2, and the following two integers are
xand
c(1≤x,c≤n), representing an operation of the second type.
It is guaranteed that the size of the standard input file does not exceed
32MiB, so you may need to use a fast approach to read the input data.