SUBMERGE - Submerging Islands

Vice City is built over a group of islands, with bridges connecting them. As anyone in Vice City knows, the biggest fear of vice-citiers is that some day the islands will submerge. The big problem with this is that once the islands submerge, some of the other islands could get disconnected. You have been hired by the mayor of Vice city to tell him how many islands, when submerged, will disconnect parts of Vice City. You should know that initially all the islands of the city are connected.

Input

The input will consist of a series of test cases. Each test case will start with the number N (1 ≤ N ≤ 10^4) of islands, and the number M of bridges (1 ≤ M ≤ 10^5). Following there will be M lines each describing a bridge. Each of these M lines will contain two integers Ui, Vi (1 ≤ Ui,Vi ≤ N), indicating that there is a bridge connecting islands Ui and Vi. The input ends with a case where N = M = 0.

Output

For each case on the input you must print a line indicating the number of islands that, when submerged, will disconnect parts of the city.

Example

Input:
3 3
1 2
2 3
1 3
6 8
1 3
6 1
6 3
4 1
6 4
5 2
3 2
3 5
0 0

Output:
0
1

Added by:Hector Navarro
Date:2013-05-16
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:MiniMaraton 2013 - UCV

hide comments
2024-06-15 03:07:20
not from codeNcode
2023-09-30 18:57:00
codencode
2023-05-07 09:11:49
codeNcode
2022-08-12 06:29:35
From CodeNcode
2022-06-09 18:05:40
so much simple problem. Thanks to codeNcode.
2022-04-26 19:05:28
From CodeNCode playlist
2021-12-04 20:16:39
How is it a SCC problem. Isn't it a articulation point problem?
2021-12-03 05:52:07
CodeNcode supremacy!!!!1
2021-11-20 12:09:48
CodeNCode peeps raise hand haha
2021-09-10 11:50:40
yes
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.