Submit solution

Points: 100
Time limit: 3.0s
Memory limit: 256M

Problem type
Allowed languages
C, C++, Java 11, JAVA 8, Python, ZIG

There is a town with NN citizens. It is known that some pairs of people are friends. According to the famous saying that The friends of my friends are my friends, too" it follows that if AA and BB are friends and BB and CC are friends then AA and CC are friends, too.

Your task is to count how many people there are in the largest group of friends.


Input consists of several datasets. The first line of the input consists of a line with the number of test cases to follow.

The first line of each dataset contains tho numbers N and M, where N is the number of town’s citizens (1 \leq N \leq 300001 \leq N \leq 30000) and MM is the number of pairs of people (0 \leq M \leq 5000000 \leq M \leq 500000), which are known to be friends. Each of the following M lines consists of two integers AA and BB (1 \leq A \leq N1 \leq A \leq N, 1 \leq B \leq N1 \leq B \leq N, A \neq BA \neq B) which describe that AA and BB are friends. There could be repetitions among the given pairs.


The output for each test case should contain (on a line by itself) one number denoting how many people there are in the largest group of friends on a line by itself.

Sample Input

3 2
1 2
2 3
10 12
1 2
3 1
3 4
5 4
3 5
4 6
5 2
2 1
7 1
1 2
9 10
8 9

Sample Output



There are no comments at the moment.