There are multiple test cases. The first line of input contains an integer $T$, indicating the number of test cases. For each test case:
The first line contains two integer $n$ and $m$ $(1 \le n, m \le 10^5)$ -- the number of vertices and the number of queries. The next line contains 6 integers $a_1, b_1, a_2, b_2, a_3, b_3$ $(1 \le a_1,a_2,a_3,b_1,b_2,b_3 \le n)$, separated by a space, denoting the new added three edges are $(a_1,b_1)$, $(a_2,b_2)$, $(a_3,b_3)$.
In the next $m$ lines, each contains two integers $s_i$ and $t_i$ $(1 \le s_i, t_i \le n)$, denoting a query.
The sum of values of $m$ in all test cases doesn't exceed $10^6$.