You are given an undirected tree with $$$n$$$ vertices, labeled from $$$0$$$ to $$$n-1$$$. The tree has $$$n-1$$$ edges and is connected and acyclic.
Your task is to select exactly $$$k$$$ vertices ($$$2 \leq k \leq n$$$) such that the minimum $$$\operatorname{MEX}$$$ value over all paths between two chosen vertices is maximized.
For any two vertices $$$u$$$ and $$$v$$$, define $$$P_{uv}$$$ as the set of vertex labels that appear on the unique simple path between them. The function $$$\operatorname{MEX}(P_{uv})$$$ is defined as the smallest non-negative integer that does not appear in $$$P_{uv}$$$.
Formally, for a chosen set of vertices $$$S$$$ with $$$|S| = k$$$, we define: $$$$$$ f(S) = \min_{u, v \in S, u \neq v} \operatorname{MEX}(P_{uv}). $$$$$$
Your goal is to maximize $$$f(S)$$$ over all valid choices of $$$S$$$.
For each integer $$$k$$$ from $$$2$$$ to $$$n$$$, compute the maximum possible value of $$$f(S)$$$.
The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 10^4)$$$ — the number of test cases.
The first line of each test case contains an integer $$$n$$$ $$$(3 \leq n \leq 10^5)$$$ — the number of nodes in the tree.
The next $$$n-1$$$ lines each contain two integers $$$u$$$ and $$$v$$$ $$$(0 \leq u, v \lt n)$$$, representing an undirected edge between nodes $$$u$$$ and $$$v$$$.
It is guaranteed that the sum of all $$$n$$$ over all test cases does not exceed $$$10^6$$$.
For each test case, print $$$n-1$$$ integers. The $$$i$$$-th integer should represent the maximum possible value of the minimum $$$\operatorname{MEX}$$$ when choosing $$$k = i+1$$$ nodes.
150 11 31 40 2
4 1 0 0
The given tree has $$$n = 5$$$ nodes with the following structure:
For different values of $$$k$$$: