SP22366 BAD - Badminton Tournament - Easy

Description

In a badminton tournament, each of n players play all the other n-1 players. Each game results in either a win, or a loss. The players then write down the names of those whom they defeated(say list 1), and also of those who they(players of list 1) defeated. For example, if A beats B and B beats C, then A writes the names of both B and C.

Input Format

First line of input contains an integer t(number of test cases), each test case starts with an integer n followed by nc2(i.e n\*(n - 1)/2) lines(results of all matches) each containing two integers a, b seperated by a space which means a defeated b.

Output Format

Print a line for each test case containing two space seperated integers p, q where p is the player with maximum possible number of players in his list and q is that number(maximum possible number of players in a list). In case there are many players with maximum number of players in their list, print minimum of such possibilities of p.