CABLETV - Cable TV Network

题意翻译

电视电缆网络的继电器之间的连接是双向的。如果任意两个继电器之间都连通,那么这个网络就是连通的,否则不连通。特别地,一个空网络或只有一个继电器的网络是连通的。 定义一个有n个继电器的网络的安全指数f为 1. 如果不管移除几个继电器,网络都连通,f=n 2. 使网络不连通至少要移除的继电器数 给出t($t \le 20$)个网络,求每个网络的安全指数(每个网络的继电器数$\le 50$)。 输入格式、输出格式见样例。

题目描述

The interconnection of the relays in a cable TV network is bi-directional. The network is connected if there is at least one interconnection path between each pair of relays present in the network. Otherwise the network is disconnected. An empty network or a network with a single relay is considered connected. The safety factor **f** of a network with **n** relays is: 1\. **n**, if the net remains connected regardless the number of relays removed from the net. 2\. The minimal number of relays that disconnect the network when removed. ![Exemplary illustration](https://cdn.luogu.com.cn/upload/vjudge_pic/SP300/154eec42b98e0c5ed875fc9854794018bfb26a2b.png)For example, consider the nets from figure 1, where the circles mark the relays and the solid lines correspond to interconnection cables. The network (a) is connected regardless the number of relays that are removed and, according to rule (1), f=n=3. The network (b) is disconnected when 0 relays are removed, hence f=0 by rule (2). The network (c) is disconnected when the relays 1 and 2 or 1 and 3 are removed. The safety factor is 2.

输入输出格式

输入格式


The input starts with a line containing a single integer **t** <= 20, the number of test cases. **t** test cases follow. Write a program that computes the safety factor for the cable networks encoded by the data sets. Each data set starts with two integers: 0 <= **n** <=50,the number of relays in the net, and **m**, the number of cables in the net. Follow **m** data pairs (u,v), u < v, where u and v are relay identifiers (integers in the range 0..**n**-1). The pair (u,v) designates the cable that interconnects the relays u and v. The pairs may occur in any order. Except the (u,v) pairs, which do not contain white spaces, white spaces can occur freely in input. Input data terminate with an end of file and are correct.

输出格式


For each data set, prints from the beginning of a line, the safety factor of the encoded net.

输入输出样例

输入样例 #1

5
0 0
1 0
3 3 (0,1) (0,2) (1,2)
2 0
5 7 (0,1) (0,2) (1,3) (1,2) (1,4) (2,3) (3,4)

输出样例 #1

0
1
3
0
2