Anna Hazare is a well known social activist in India.

On 5th April, 2011 he started "Lokpal Bill movement".

Chef is very excited about this movement. He is thinking of contributing to it. He gathers his cook-herd and starts thinking about how our community can contribute to this.

All of them are excited about this too, but no one could come up with any idea. Cooks were slightly disappointed with this and went to consult their friends.

One of the geekiest friend gave them the idea of spreading knowledge through Facebook. But we do not want to spam people's wall. So our cook came up with the idea of dividing Facebook users into small friend groups and then identify the most popular friend in each group and post on his / her wall. They started dividing users into groups of friends and identifying the most popular amongst them.

The notoriety of a friend is defined as the averaged distance from all the other friends in his / her group. This measure considers the friend himself, and the trivial distance of '0' that he / she has with himself / herself.

The most popular friend in a group is the friend whose notoriety is least among all the friends in the group. 

Distance between X and Y is defined as follows:

Minimum number of profiles that X needs to visit for reaching Y's profile(Including Y's profile). X can open only those profiles which are in the friend list of the current opened profile. For Example:

- Suppose A is friend of B.

- B has two friends C and D.

- E is a friend of D.

Now, the distance between A and B is 1, A and C is 2, C and E is 3. 

So, one of our smart cooks took the responsibility of identifying the most popular friend in each group and others will go to persuade them for posting.  This cheeky fellow knows that he can release his burden by giving this task as a long contest problem.

Now, he is asking you to write a program to identify the most popular friend among all the friends in each group. Also, our smart cook wants to know the average distance of everyone from the most popular friend.

-----Input-----

Friends in a group are labelled with numbers to hide their Facebook identity. The first line of input contains the number of groups in which users are divided. First line of each group contains the number of friends that belong to that group. ith line of each group contains the space separated friend list of 'i'. You are assured that each friend's profile can be accessed by the profile of every other friend by following some sequence of profile visits.

-----Output-----
Your output contains the most popular friend name label along with the average distance (space separated) from all other friends (including himself / herself) in six digits of precision. There might be multiple most popular friend, in that case output the friend labelled with least number. 

-----Note:-----

Each person in a group have atleast one friend and he/she cannot be in his/her own friend list. 

Number of friends in a group cannot be more than 100.

There are atmost 100 groups.

-----Example-----
Input:
1
6
3
5
1 4
3 5 6
2 4 6
4 5

Output:
4 1.166667

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'from collections import deque\nimport psyco\npsyco.full()\n\ngraph = [[]]\nWHITE, GRAY, BLACK = 0, 1, 2\n\ndef notoriety(x, f_count):\n    queue = deque([x])\n    d = [0 for i in range(f_count+1)]\n    p = [0 for i in range(f_count+1)]\n    color = [WHITE for i in range(f_count+1)]\n    while len(queue) > 0:\n        top = queue.pop()\n        for node in graph[top]:\n            if color[node] == WHITE:\n                queue.appendleft(node)\n                color[node], p[node], d[node] = GRAY, top, d[top] + 1\n        color[top] = BLACK\n    return sum(d)/(f_count*1.0)\n        \ndef main():\n    groups = int(input())\n    for g in range(groups):\n        global graph\n        graph = [[]]\n        no_of_friends = int(input())\n        for i in range(no_of_friends):\n            graph.append(list(map(int,input().split())))\n        min_notoriety, popular = 10000000, -1 # yet another magic number\n        for f in range(1,no_of_friends+1):\n            curr_not = notoriety(f, no_of_friends)\n            if  curr_not < min_notoriety:\n                min_notoriety,popular = curr_not, f\n        assert popular != -1\n        print(popular, "%.6f" %min_notoriety)\n\ndef __starting_point():\n    main()\n\n__starting_point()'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: