Call It What You Want

아직 제출이 없습니다시간 제한1초메모리 제한64 MB

문제

Professor Zhang has heard that the longest path problem cannot be solved in polynomial time for arbitrary graphs unless P = NP. Now, Professor Zhang would like to solve this problem in polynomial time in some graphs.

The longest path problem is the problem of finding a simple path of maximum length in a given graph. A path is called simple if it does not have any repeated vertices. The length of a path is the number of edges in this path.

입력

There are multiple test cases. The first line of input contains an integer TT (about 350350) indicating the number of test cases. For each test case:

The first line contains two integers nn and mm (3n1043 \le n \le 10^4, nmn+4n \le m \le n + 4): the number of vertices and the number of edges.

Each of the following mm lines contains two integers a_ia\_i and b_ib\_i which denotes an edge between vertices a_ia\_i and b_ib\_i (1a_i,b_in1 \le a\_i, b\_i \le n, a_ib_ia\_i \ne b\_i).

It is guaranteed that the graph is connected and does not contain multiple edges.

The total size of the input is at most 44 mebibytes.

출력

For each test case, output an integer denoting the length of the longest path.