The first line contains a single integer $T$ ($1 \leq T \leq 300$), the number of test cases. For each test case:
The first line contains a single integer $n$ ($1 \leq n \leq 300\,000$), denoting the length of each permutation.
The second line contains $n$ distinct integers $P_1,P_2,\dots,P_n$ ($1\leq P_i\leq n$).
The third line contains $n$ distinct integers $Q_1,Q_2,\dots,Q_n$ ($1\leq Q_i\leq n$).
The fourth line contains $2n$ integers $S_1,S_2,\dots,S_{2n}$ ($1\leq S_i\leq n$).
It is guaranteed that the sum of all $n$ is at most $2\,000\,000$.