|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||1||1||1||100.000%|
Everyone knows that at Jagiellonian University we do love plants a lot. We created hundreds of problems about trees, forests and even cacti! Unfortunately, problems about animals are not that popular. Today we want to prove that we love animals as well.
We say that a graph is a jellyfish, if it is a simple connected undirected graph with equal number of vertices and edges. You are given a jellyfish $J$ with $n$ vertices. For an arbitrary subset of vertices $S \subseteq J$, we say that $S$ is an awesome subset if for every $T \subseteq S$ there exists a connected subgraph of the jellyfish which contains every vertex from $T$ and does not contain any other vertex from $S$.
What is the maximum possible size of an awesome subset of $J$?
The first line of input contains the number of test cases $z$. The descriptions of the test cases follow.
The first line of each test case contains one integer $n$ ($3 \leq n \leq 100\,000$) -- the number of vertices of the jellyfish.
The next $n$ lines contain two integers $u_i$, $v_i$ ($1 \leq u_i \neq v_i \leq n$) each, corresponding to the jellyfish edges. It is guaranteed that the given graph is a jellyfish, and every two vertices are connected by at most one edge.
The total number of vertices in all test cases does not exceed $10^6$.
For each test case, output a single line which contains a single integer -- the maximum possible size of an awesome subset of the jellyfish.
2 6 1 2 2 3 3 4 4 1 2 5 2 6 4 1 2 2 3 3 4 4 1