Miguel and Misael have a weighted tree with $$$n$$$ vertices. They are very proud of their tree and believe that its structure is already perfect. Aaron, however, disagrees. He thinks that the tree would be better if its connected components had smaller diameters, so he decides to modify it by removing some of its edges. For each integer $$$k$$$ from $$$1$$$ to $$$n-1$$$, Aaron wants to remove exactly $$$k$$$ edges from the tree. After doing so, the tree is divided into $$$k+1$$$ connected components.
The diameter of a connected component is the maximum distance between any pair of its vertices, where the distance between two vertices is the sum of the weights of the edges on the unique path connecting them. The diameter of the resulting forest is defined as the maximum diameter among all its connected components.
For every $$$k$$$ from $$$1$$$ to $$$n-1$$$, determine the minimum possible diameter of the resulting forest that Aaron can obtain after removing exactly $$$k$$$ edges.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases.
The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 2000$$$) — the number of vertices of the tree.
Each of the next $$$n-1$$$ lines contains three integers $$$u$$$, $$$v$$$, and $$$w$$$ ($$$1 \le u, v \le n$$$ and $$$1 \le w \le 10^9$$$), indicating that there is an edge between vertices $$$u$$$ and $$$v$$$ with weight $$$w$$$.
It is guaranteed that the given graph is a tree.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2000$$$.
For each test case, print a single line containing $$$n-1$$$ integers. The $$$k$$$-th integer must be the minimum possible diameter of the resulting forest after removing exactly $$$k$$$ edges, for every $$$1 \le k \le n-1$$$.
521 2 731 2 42 3 641 2 31 3 51 4 251 2 22 3 23 4 24 5 261 2 41 3 13 4 73 5 35 6 2
04 05 2 04 2 2 010 5 2 1 0
| Название |
|---|


