#BAD. Badminton Tournament - Easy

Badminton Tournament - Easy

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. 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.

Consider a game between A, B, C, D, E, F, G where A defeats B, C; B defeats E; C defeats F. Then A's list will have (B, C, E, F) and will not include G.

Note: Say A defeats B, B defeats C and C defeats D. D is not necessarily present in A's list, a player's list contains players of list1 and players defeated by those in list1 (immediate win).

In this problem, we represent players by integers from 1 to n (Both inclusive.)

Input

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 separated by a space which means a defeated b.

Output

Print a line for each test case containing two space separated 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.

Constraints

t <= 50, n <= 250, 1 <= a, b <= n

Example

Input:
1
3
1 2
2 3
3 1

Output: 1 2

</p>

My best: 0.53s with PyPy and 1.50s with Python 2.7.9. Good Luck! :)