


Use zero-based indexing for the nodes.
The tree is always rooted at 0.
The very first line of input contains an integer ‘T’, denoting the number of test cases.
The first line of each test case contains an integer ‘N’, denoting the number of nodes in the tree.
The next N-1 lines of each test case contain two space-separated integers u and v, denoting an edge between node u and node v.
For each test case, the largest distance between two nodes in the tree is printed.
You do not need to print anything, it has already been taken care of. Just implement the given function.
Can you solve this problem in just one traversal?
1 <= T <= 100
2 <= N <= 3000
0 <= u , v < N
Time Limit: 1 sec
Algorithm:
Note:
Algorithm:
Algorithm: