publicity

To improve the participation in the online programming contest, CodeBurst, its organizers have planned a word of mouth advertising campaign. The organizers have identified a target audience of size N and want to invite each of these people to the contest. But being very busy, they cannot possibly go to each one of them personally.So, they have come up with a way in which they would invite a few people from the target audience and these chosen few would further invite their friends and so on. So, given the size of the target audience N and the friendship relation between members of the audience, can you give the minimum number of people that the organizers need to reach out to?

Input Format

The first line of input contains the number of test cases T. (1 ≤ T ≤ 10)

The second line of input contains the number of people N. (1 ≤ N ≤ 100,000)

The people are numbered from 0 to N-1.

The third line contains the number of friendship entries e. (0 ≤ e ≤ N-1)

Then e lines follow, each describing a friendship entry.

A friendship entry is a line containing 2 space separated integers a,b such that a is a friend of b and vice versa. (0 ≤ a,b ≤ N-1 and a,b are distinct)

Output Fomat

For each test case, a single line containing the minimum number of people that the organizers need to reach out to.

SAMPLE INPUT
2
4
2
0 1
1 2
3
0

SAMPLE OUTPUT
2
3

Source: hackerearth | Difficulty: MEDIUM


Solutions: