[CF2290H] 额外道路 (Extra Road)
Problem Statement
There are cities numbered through , connected by bidirectional roads forming a tree. City is the capital.
First, you must build exactly one new bidirectional road between two distinct cities that are not already directly connected by a road.
Then, an adversary observes your network and permanently closes exactly one of the existing roads (either one of the original roads or your newly built road). A city is considered reachable if there is a path from the capital to it using the remaining open roads (city is always reachable).
Choose where to add the extra road so as to maximize the minimum possible number of reachable cities in the worst case, and print this maximum number.
Input
The first line contains () — the number of test cases.
The first line of each test case contains (). The next lines each contain two integers and (, ) describing an edge of the tree.
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, print a single integer — the maximum guaranteed number of reachable cities.
Example
5
3
1 2
2 3
4
1 2
1 3
1 4
6
1 2
2 3
2 4
3 5
4 6
5
2 1
1 3
2 4
3 5
6
1 2
2 3
3 4
3 5
3 6
3
3
4
5
5
Note
- Constraints: , , .
- Source: Codeforces 2290H · Extra Road