Statement : Alternating Path
You are given an undirected graph with
Your task is to assign a direction to each edge. After directing the edges, a sequence of vertices
- the edge
is directed from to ; - the edge
is directed from to ; - the edge
is directed from to ; - the edge
is directed from to ; - and so on (alternating forward / backward along the sequence).
A vertex
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
Each test case has:
- A line with two integers
and ( ; ) — number of vertices and edges. lines, each with two integers and ( ) — an edge between and .
Additional constraints: no self-loops or multiple edges; the sum of
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