The first line contains a single integer $T$, indicating the number of test cases.
Each test case begins with three integers $N,~M1,~M2$, indicating the number of caves, the number of undirectional tunnels, the number of directional tunnels.
The next $M1$ lines contain the details of the undirectional tunnels. Each line contains two integers $u,~v$ meaning that there is a undirectional tunnel between $u,~v$. ($u~\neq~v$)
The next $M2$ lines contain the details of the directional tunnels. Each line contains integers $u,~v$ meaning that there is a directional tunnel from $u$ to $v$. ($u~\neq~v$)
$T$ is about 100.
$1~\le~N, M1, M2~\le~1000000.$
There may be some tunnels connect the same pair of caves.
The ratio of test cases with $N~\gt~1000$ is less than 5%.