Given a connected acyclic graph with N nodes and N-1 edges, find out the pair of nodes that are at even distance from each other.
The first line of input contains an integer T denoting the number of test cases.
First line of each test case contains a single integer N denoting the number of nodes in graph.
Second line of each test case contains N-1 pair of nodes xi , yi denoting that there is an edges between them.
For each test case output a single integer denoting the pair of nodes which are at even distance.
1 2 2 3
Only such pair is (1,3) where distance b/w them is 2
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.