In the magical land of Wonderland, there are $$$N$$$ cities connected by roads. The road network has a special property — there is exactly one path between any two cities. A path is a sequence of different cities connected sequentially by roads.
The Queen of Wonderland maintains many teams of $$$K$$$ guards in her barracks. She wants to deploy one of these teams to protect all cities against potential threats within the kingdom. Each guard protects the city they are stationed in, as well as all cities whose distance from that city along the roads is at most $$$R$$$. The distance between two cities is defined as the number of roads on the unique path connecting them.
All guards in a single team have the same protection radius $$$R$$$. Since the Queen wants to keep her strongest guards in reserve, she wishes to choose a team and deploy it in such a way that every city is protected while minimizing the radius $$$R$$$.
Your task is to determine the minimum possible value of $$$R$$$ such that it is possible to place the $$$K$$$ guards in some cities so that every city in Wonderland is protected by at least one guard.
The first line of the input contains a single integer $$$T (1 \le T \le 5)$$$ — the number of test cases.
The first line of each test case contains two integers $$$N$$$ and $$$K$$$ $$$(1 \le K \le N \le 10^5)$$$ — the number of cities in Wonderland and the number of guards respectively.
Each of the next $$$N-1$$$ lines contain two integers $$$U$$$ and $$$V$$$ $$$(1 \le U, V \le N, U \neq V)$$$ — indicating a road connecting city $$$U$$$ and city $$$V$$$.
It is guaranteed that the sum of $$$N$$$ over all test cases does not exceed $$$5 \cdot 10^5$$$.
For each test case, print a single integer in a line — the minimum possible value of $$$R$$$.
1 8 3 1 2 2 3 2 4 3 5 3 6 4 7 4 8
1
| Name |
|---|


