Mr. Nežmah has a tree with $$$n$$$ nodes. On each edge $$$(u_i, v_i)$$$, there is a number $$$a_i$$$. Nežmah noticed an interesting property: every value of $$$a_i$$$ appears on at most six edges.
For every pair of nodes $$$u$$$ and $$$v$$$, let's define their goodness as the smallest non-negative integer that doesn't appear on any edges on the path from $$$u$$$ to $$$v$$$. Find the maximum value of goodness across all pairs of nodes.
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 a single integer $$$n$$$ ($$$3 \leq n \leq 10^5$$$).
The following $$$n - 1$$$ lines of each test case contain $$$u_i$$$, $$$v_i$$$, and $$$a_i$$$ ($$$1 \leq u_i, v_i \leq n, u_i \neq v_i, 0 \leq a_i \lt n$$$).
It's guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.
For each test case, in a single line, output the maximum value of goodness across all pairs of nodes.
342 1 01 3 11 4 251 2 01 3 12 4 02 5 2102 3 06 10 13 7 210 9 08 2 01 9 25 2 19 3 24 10 3
2 3 4
| Name |
|---|


