First line is one integer $T$, indicating $T$ test cases. In each case:
First line is 2 integers $n, q$, indicating $n$ cities and $q$ queries.
Next line is $n - 1$ integers $r_1, r_2, \ldots, r_{n-1}$, the $i$-th integer indicates the road from city $i + 1$ to city $r_i$.
Next is $q$ queries, in each query:
First line is 3 integer $|A|,|B|,|C|$, indicating the size of set A, B, C.
Next line is $|A|$ integers, indicating the set $A$.
Next line is $|B|$ integers, indicating the set $B$.
Next line is $|C|$ integers, indicating the set $C$.
$1 \le T \le 20,$ $1\le n, q, |A|, |B|, |C| \le 2\times 10^5,$ for all cases $\sum n\le 2\times 10^5,$ $\sum q\le 2\times 10^5,$ for all queries in all cases $\sum |A|+\sum |B|+\sum|C|\le 2\times 10^5$.