Statement : Alternating Path
You are given an undirected graph with $n$ vertices and $m$ edges. Vertices are numbered from $1$ to $n$. The graph has no self-loops or multiple edges.
Your task is to assign a direction to each edge. After directing the edges, a sequence of vertices $v_1, v_2, \ldots, v_k$ (with $k$ arbitrary and repetition allowed) is an alternating path if:
- the edge $(v_1, v_2)$ is directed from $v_1$ to $v_2$;
- the edge $(v_2, v_3)$ is directed from $v_3$ to $v_2$;
- the edge $(v_3, v_4)$ is directed from $v_3$ to $v_4$;
- the edge $(v_4, v_5)$ is directed from $v_5$ to $v_4$;
- and so on (alternating forward / backward along the sequence).
A vertex $v$ is beautiful if every path in the original graph that starts at $v$ is an alternating path in the resulting directed graph.
What is the maximum number of vertices that can be made beautiful after directing the edges?
The first line contains the number of test cases $t$ ($1 \le t \le 10^4$).
Each test case has:
- A line with two integers $n$ and $m$ ($1 \le n \le 2 \cdot 10^5$; $0 \le m \le 2 \cdot 10^5$) — number of vertices and edges.
- $m$ lines, each with two integers $v$ and $u$ ($1 \le v, u \le n$) — an edge between $v$ and $u$.
Additional constraints: no self-loops or multiple edges; the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$; the sum of $m$ over all test cases does not exceed $2 \cdot 10^5$.
For each test case, print one integer — the maximum number of vertices that can be made beautiful.
Input
4
8 9
1 3
1 4
2 3
2 4
5 6
6 7
7 8
8 5
6 8
4 0
6 2
1 5
2 3
1 0
Output
2
4
4
1