

For the given graph:

Node 1 is connected to all other nodes. Hence node 1 is the centre of this star graph.
The first line contains an integer 'T' which denotes the number of test cases.
The first line of each test case contains ‘M’, no of edges.
The following ‘M’ lines contain two integers ‘U’ and ‘V’ denoting there is an undirected edge between node ‘U’ and node ‘V’.
For each test case, return the centre of the given star graph.
The first and only line of output of each test case prints the centre of a given star graph.
You don't need to print anything, it has already been taken care of. Just implement the given function.
1 ≤ T ≤ 10
3 ≤ M ≤ 10^4
M is always equal to N - 1
EDGES.length = M
1 ≤ U, V ≤ N
Time limit: 1 sec
Looking at the problem, we can directly see that the node having ‘M’ number of edges connecting it, where ‘M’ is the number of edges, will be the centre node.
We can notice that the centre node has to appear in every edge. This means the node that appears in both EDGES[0] and EDGES[1] will be the center node. This is much better than direct implementation.