输入描述:
The first line is an interger T, indicating the number of test cases.
Then in each case:
The first line contains one integer N (N ≤ 2e4), representing the number of nodes in the tree.
The second line contains one integer Y (0 ≤ Y ≤ N), representing the maximum number of nodes allowed to be reachable from the root.
Each of the following N-1 lines contains three integers U, V (0 ≤ U, V < N), W(0 ≤ W ≤ 1e7), representing that the edge between node U and node V has a weight W. The integers are separated by a space.
The total sum of N in all cases is less than 1e5.
输出描述:
T lines and each line contains an integer, representing the minimum threshold X (X≥0).
Sample Input