Given an array $a$ of $n$ elements, print any value that appears at least three times or print -1 if there is no such value.


-----Input-----

The first line contains an integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first line of each test case contains an integer $n$ ($1 \leq n \leq 2\cdot10^5$) — the length of the array.

The second line of each test case contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \leq a_i \leq n$) — the elements of the array.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2\cdot10^5$.


-----Output-----

For each test case, print any value that appears at least three times or print -1 if there is no such value.


-----Examples-----

Input
7
1
1
3
2 2 2
7
2 2 3 3 4 2 2
8
1 4 3 4 3 2 4 1
9
1 1 1 2 2 2 3 3 3
5
1 5 2 4 3
4
4 4 4 4
Output
-1
2
2
4
3
-1
4


-----Note-----

In the first test case there is just a single element, so it can't occur at least three times and the answer is -1.

In the second test case, all three elements of the array are equal to $2$, so $2$ occurs three times, and so the answer is $2$.

For the third test case, $2$ occurs four times, so the answer is $2$.

For the fourth test case, $4$ occurs three times, so the answer is $4$.

For the fifth test case, $1$, $2$ and $3$ all occur at least three times, so they are all valid outputs.

For the sixth test case, all elements are distinct, so none of them occurs at least three times and the answer is -1.

Difficulty: EASY

Solutions:
import sys
from typing import Tuple
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def inps():
	return str(input()).strip()
T = inp()
for i in range(T):
	r = inp()
	dict = {}
	result = -1
	x = input().split()
	for k in x:
		if k in dict:
			dict[k] += 1
		else:
			dict[k] = 1
		if dict[k] >= 3:
			result = k
	print(result)


from collections import Counter
t = int(input())
results = []
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	c = Counter(arr)
	results.append({j: i for (i, j) in c.items()}[max(c.values())] if any(filter(lambda x: x >= 3, c.values())) else -1)
print(*results, sep='\n')


k = input()
lst = []
for elm in range(int(k)):
	m = input()
	l = input().split()
	lst.append(l)
dic = {}
for elm in lst:
	dic = {}
	for selm in elm:
		if selm not in dic.keys():
			dic[selm] = 1
		else:
			temp = dic[selm]
			temp += 1
			dic[selm] = temp
	maxval = None
	maxkey = None
	for (k, v) in dic.items():
		if maxval == None:
			maxkey = k
			maxval = v
		elif maxval <= v:
			maxkey = k
			maxval = v
	if maxval >= 3:
		print(maxkey)
	else:
		print('-1')


x1 = int(input())
for i in range(x1):
	z = int(input())
	l = input().split(' ')
	x = -1
	d = {}
	for j in l:
		if j not in d:
			d[j] = 1
		elif d[j] >= 2:
			x = j
		elif d[j] < 2:
			d[j] += 1
	print(x)


t = int(input())
while t > 0:
	n = int(input())
	ans = -1
	k = list(map(int, input().split()))
	z = {}
	for i in k:
		if i not in z:
			z[i] = 1
		else:
			z[i] += 1
			if z[i] >= 3:
				ans = i
	print(ans)
	t -= 1


m = int(input())
for i in range(0, m):
	l = int(input())
	n = input().split()
	n.sort()
	count = 0
	x = -1
	for i in range(len(n) - 1):
		if n[i] == n[i + 1]:
			count += 1
			if count + 1 > 2:
				x = n[i]
		else:
			count = 0
	print(x)