**Problem Description**

**Input**

An integer T in the first line, then follows T groups of test data.

In each data group, two integers n and m in the first line indicates that there are n fragments(No.1 to No.n) and m relations. Then m lines and two numbers each line. The a[i] and b[i] in line i indicates that the fragment a[i] and b[i] can be eliminated through combination.

(0<=N<=500,0<=M<=1000)

**Output**

Each line an integer of the minimum amount of the fragments left in each group of test data.

**Sample Input**

1 6 3 1 2 3 2 3 4

**Sample Output**

2

**Source**

2014市赛