As White Walkers have attacked winterfell,Cersei has to send her army to winterfell but through tunnels.
Unwilling to do so, she wants to delay as much as she can so she take longest route to Winterfell.
You are given no of tunnels(n) followed by tunnel 'u' connecting tunnel 'v' having distance 'w'.
Now,you being fan of Cersie, is keen to find the longest route.
The first line of input contains the number of testcases t.
The first line of each testcase contains the number of tunnels (n). Each 'n-1' lines contain 'u','v' and 'w' denoting that tunnel 'u' and 'v' are connected and distance between them is 'w'.
For each test case print the length of longest route.
1 5 3
3 5 4
5 4 2
2 4 5
4 7 6
7 8 2
7 6 1
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.