Doctor Strange
Submissions: 869   Accuracy:

27.49%

  Difficulty: Hard   Marks: 8

Kamar-taj is a place where "The Acient One" trains people to protect earth from other dimensions.
The earth is protected by 'n' sanctums, destroying any of it will lead to invasion on earth.
The sanctums are connected by 'm' bridges.
Now , you being on dormammu's side , want to finds no of sanctum destroying which will disconnect the sanctums.

Input:
First line of the input contains T the number of test cases.
First line of each test case contains n(no of sanctums) and m(no of bridges).
Each m line of test case contains p and q denoting sanctum p is connected to sanctum q.

Output:
Each new line of the output contains no of sanctums when destroyed will disconnect other sanctums of Earth .

Constraints:

1 ≤ T ≤ 100
1 ≤ n ≤ 30000
1 ≤ m ≤ 30000
1 ≤ p,q ≤ n

Example:
Input:
1
5 5
1 2
1 3
3 2
3 4
5 4

Output:
2

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: chunky_2808
Author: Chunky_2808


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.