With the provincial selection approaching, Xiao Q, feeling unmotivated to study, encourages Xiao C to slack off with him by playing a strategy game.
The map of this strategy game consists of $n$ cities and $m$ bidirectional roads connecting these cities, such that it is always possible to travel from any city to any other city along the roads. Xiao C has already occupied at least two of these cities. Xiao Q can destroy one city not occupied by Xiao C, along with all roads connected to that city. If, after destroying this city, there exist two cities $u$ and $v$ occupied by Xiao C such that it is impossible to travel from $u$ to $v$ along the remaining roads, then Xiao Q wins the game.
Xiao Q and Xiao C play $q$ rounds of the game. In each round, a set $S$ of cities occupied by Xiao C is given. You need to help Xiao Q count how many cities he can destroy to win that round.
Input
The first line contains a positive integer $T$, representing the number of test cases.
For each test case:
The first line contains two integers $n$ and $m$, representing the number of cities and roads in the map.
The next $m$ lines each contain two integers $u$ and $v$ ($1 \le u < v \le n$), representing a road between city $u$ and city $v$. There may be multiple roads between the same pair of cities.
The $(m + 1)$-th line contains an integer $q$, representing the number of game rounds.
The next $q$ lines each start with an integer $|S|$ ($2 \le |S| \le n$), representing the number of cities occupied by Xiao C, followed by $|S|$ integers $s_1, s_2, \dots, s_{|S|}$ ($1 \le s_1 < s_2 < \dots < s_{|S|} \le n$), representing the cities occupied by Xiao C.
Output
For each game round, output a single line containing an integer representing the number of cities Xiao Q can destroy to win that round.
Examples
Input 1
2 7 6 1 2 1 3 2 4 2 5 3 6 3 7 3 2 1 2 3 2 3 4 4 4 5 6 7 6 6 1 2 1 3 2 3 1 4 2 5 3 6 4 3 1 2 3 3 1 2 6 3 1 5 6 3 4 5 6
Output 1
0 1 3 0 1 2 3
Note
- $1 \le T \le 10$
- $2 \le n \le 10^5$ and $n - 1 \le m \le 2 \times 10^5$
- $1 \le q \le 10^5$
- For each test case, $\sum |S| \le 2 \times 10^5$
Subtask 1 (30 points): For each test case, $\sum |S| \le 20$.
Subtask 2 (45 points): For each query, $|S| = 2$.
Subtask 3 (25 points): No additional restrictions.