Given an array A of length N, your task is to find the element which repeats in A maximum number of times as well as the corresponding count. In case of ties, choose the smaller element first.

-----Input-----
First line of input contains an integer T, denoting the number of test cases. Then follows description of T cases. Each case begins with a single integer N, the length of A. Then follow N space separated integers in next line.  Assume that 1 <= T <= 100, 1 <= N <= 100 and for all i in [1..N] : 1 <= A[i] <= 10000

-----Output-----
For each test case, output two space separated integers V & C. V is the value which occurs maximum number of times and C is its count.

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

Output:
2 2
1 3

Description:
In first case 2 occurs twice whereas all other elements occur only once. 
In second case, both 1 and 2 occur 3 times but 1 is smaller than 2.

```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 = "#!/usr/bin/env python2\n# -*- coding: utf-8 -*-\nimport sys\nifs = sys.stdin\nofs = sys.stdout\n\nfrom itertools import repeat\nfrom heapq import nlargest\nfrom operator import itemgetter\n\nclass bag(dict):\n\n    def __init__(self, data=()):\n        self.update(data)\n\n    def __missing__(self, key):\n        return 0\n\n    def update(self, other):\n        if hasattr(other, 'items'):\n            super(bag, self).update(other)\n        else:\n            for elem in other:\n                self[elem] += 1\n\n    def __setitem__(self, elem, n):\n        if n <= 0:\n            if elem in self:\n                del self[elem]\n        else:\n            super(bag, self).__setitem__(elem, n)\n\n    def itermultiple(self):\n        for elem, cnt in self.items():\n            for _ in range(cnt):\n                yield elem\n\n    def nitems(self):\n        return sum(self.values())\n\n    def most_common(self, n=None):\n        if n is None:\n            return sorted(iter(self.items()), key=itemgetter(1), reverse=True)\n        else:\n            return nlargest(n, iter(self.items()), key=itemgetter(1))\n\n    def __repr__(self):\n        return '%s(%s)' % (self.__class__.__name__, dict.__repr__(self))\n\n    def add(self, item, n=1):\n        self[item] += n\n\n    def discard(self, item, n=1):\n        self[item] -= n\n\n\ndef solve(A):\n    C = bag(A)\n    MC = C.most_common()\n    e,c = MC.pop(0)\n    c_max = c\n    e_min = e\n    for mc in MC:\n        e,c = mc\n        if c==c_max:\n            if e < e_min:\n                e_min = e\n        else:\n            break\n    return (e_min,c_max)\n\n\ndef numbers_from_line(d=' '):\n    return [int(s) for s in ifs.readline().strip().split(d) if len(s.strip())>0]\n\n\nT = int(ifs.readline())\nfor t in range(1,T+1):\n    n = int(ifs.readline())\n    A = numbers_from_line()\n    v,c = solve(A)\n    ofs.write('%d %d\\n' % (v,c))\n\n\nsys.exit(0)\n"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 18005