The first line of input contains one integer $T\ (1\le T\le 10)$, indicating the number of test cases.
For each test case, the first line contains one integer $n\ (2\le n\le 2000)$, indicating the number of crossings in the maze.
The second line contains $n-1$ integers $p_2,p_3,\ldots ,p_n\ (p_i<i)$, indicating that the $i$-th crossing is connected with the $p_i$-th crossing by a passage.
The third line contains $n$ integers $c_1,c_2,\ldots, c_n\ (1\le c_i\le n)$, indicating that the kind of element placed at crossing $i$ is $c_i$.
It is promised that for all test cases, $\sum n\le 5000$.