Chef wants to buy a new laptop. However, he is confused about which laptop to buy out of 10 different laptops. He asks his N friends for their recommendation. The i^{th} friend recommends the Chef to buy the {A_{i}}^{th} laptop (1 ≤ A_{i} ≤ 10).
 
Chef will buy the laptop which is recommended by maximum number of friends. Determine which laptop Chef buys.  
Print CONFUSED if there are multiple laptops having maximum number of recommendations.

------ Input Format ------ 

- The first line contains a single integer T - the number of test cases. Then the test cases follow.
- The first line of each test case contains an integer N - the number of Chef's friends.
- The second line of each test case contains N space-separated integers A_{1}, A_{2}, \dots, A_{N} where A_{i} denotes the recommendation of the i^{th} friend.

------ Output Format ------ 

For each test case, output in a single line, the laptop which has the maximum number of recommendations. Print CONFUSED if there are multiple laptops having maximum number of recommendations.

You may print each character of CONFUSED in uppercase or lowercase (for example, Confused, coNFused, CONFused will be considered identical).

------ Constraints ------ 

$1 ≤ T ≤ 200$
$1 ≤ N ≤ 1000$
$1 ≤A_{i} ≤10$

----- Sample Input 1 ------ 
4
5
4 4 4 2 1
7
1 2 3 4 5 6 6
6
2 2 3 3 10 8
4
7 7 8 8

----- Sample Output 1 ------ 
4
6
CONFUSED
CONFUSED

----- explanation 1 ------ 
Test case 1: Laptop $4$ has the maximum number of recommendations. Therefore, Chef will buy the $4^{th}$ laptop.

Test case 2: Laptop $6$ has the maximum number of recommendations. Therefore, Chef will buy the $6^{th}$ laptop.

Test case 3: Laptops $2$, $3$ have the maximum number of recommendations. Therefore, Chef will still be CONFUSED.

Test case 4: Laptops $7$, $8$ have the maximum number of recommendations. Therefore, Chef will still be CONFUSED.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
t = int(input())
for bunny in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	b = []
	for i in set(l):
		b.append(l.count(i))
	if b.count(max(b)) > 1:
		print('CONFUSED')
	else:
		for i in set(l):
			if l.count(i) == max(b):
				print(i)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	t = Counter(input().split()).most_common(2)
	if len(t) == 2:
		print(t[0][0] if t[0][1] > t[1][1] else 'CONFUSED')
	else:
		print(t[0][0])


for j in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	l1 = []
	l2 = []
	for i in s:
		l1.append(l.count(i))
		l2.append(i)
	if l1.count(max(l1)) > 1:
		print('CONFUSED')
	else:
		print(l2[l1.index(max(l1))])


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	se = set(li)
	li2 = []
	li3 = []
	for i in se:
		li2.append(li.count(i))
		li3.append(i)
	if li2.count(max(li2)) > 1:
		print('CONFUSED')
	else:
		print(li3[li2.index(max(li2))])


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		if i not in d:
			d[i] = 0
		d[i] += 1
	mx = max(d.values())
	c = 0
	for i in d.values():
		if i == mx:
			c += 1
	if c > 1:
		print('CONFUSED')
	else:
		for i in d:
			if mx == d[i]:
				print(i)
				break


t = int(input())
for _ in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	c = list(s)
	d = []
	e = 0
	for i in c:
		e = l.count(i)
		d.append(e)
	mx = max(d)
	w = d.index(mx)
	if d.count(mx) > 1:
		print('CONFUSED')
	else:
		print(c[w])


q = int(input())
for i in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = [l.count(j) for j in l]
	t = set(zip(l, l1))
	lk = []
	lv = []
	la = []
	for k in t:
		lk.append(k[0])
		lv.append(k[1])
	s = lv.count(max(lv))
	if s > 1:
		print('CONFUSED')
	else:
		print(lk[lv.index(max(lv))])


T = int(input())
for t in range(T):
	a = int(input())
	b = list(map(int, input().split()))
	arr = []
	count_old = 0
	for i in range(a):
		count_new = b.count(b[i])
		if count_new >= count_old:
			if count_new > count_old:
				arr.clear()
			arr.append(b[i])
			count_old = count_new
	z = set(arr)
	if len(z) == 1:
		print(*z)
	else:
		print('CONFUSED')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()[:n]))
	x = Counter(a)
	l = list(x.values())
	y = l[:]
	l.sort(reverse=True)
	m = list(x.keys())
	try:
		if l[0] == l[1]:
			print('CONFUSED')
		else:
			print(m[y.index(max(y))])
	except:
		print(m[y.index(max(y))])


for i in range(int(input())):
	n = int(input())
	f = list(map(int, input().split()))
	d = dict()
	for j in f:
		if j in d.keys():
			d[j] += 1
		else:
			d[j] = 1
	c = 0
	flag = 0
	hn = max(d.values())
	for j in d.keys():
		if d[j] == hn:
			c = j
			flag += 1
	if flag > 1:
		print('CONFUSED')
	else:
		print(c)


t = int(input())
while t != 0:
	t = t - 1
	n = int(input())
	arr = [int(i) for i in input().split()]
	x = [0] * 11
	for i in range(n):
		x[arr[i]] += 1
	ans = max(x)
	c = x.count(ans)
	if c == 1:
		print(x.index(ans))
	else:
		print('CONFUSED')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for val in list(set(l)):
		d[val] = l.count(val)
	val = list(d.values())
	if val.count(max(val)) == 1:
		res = list(filter(lambda x: d[x] == max(val), d))[0]
		print(res)
	else:
		print('CONFUSED')


from collections import Counter
goals = int(input())
for distractions in range(goals):
	wife = int(input())
	life = Counter(input().split()).most_common(2)
	if len(life) == 2:
		print(life[0][0] if life[0][1] > life[1][1] else 'CONFUSED')
	else:
		print(life[0][0])


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	l2 = []
	l3 = []
	for i in s:
		l2.append(l.count(i))
		l3.append(i)
	k = max(l2)
	if l2.count(k) == 1:
		ind = l2.index(k)
		print(l3[ind])
	else:
		print('CONFUSED')


for t in range(int(input())):
	N = int(input())
	a = list(map(int, input().split()))
	unique_a = list(set(a))
	count_a = []
	for i in unique_a:
		count_a.append(a.count(i))
	max_v = max(count_a)
	if count_a.count(max_v) > 1:
		print('CONFUSED')
	else:
		print(unique_a[count_a.index(max_v)])


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ob = Counter(l)
	k = [x for x in ob.values()]
	p = max(k)
	c = 0
	for y in range(len(k)):
		if k[y] == p:
			c += 1
	if c == 1:
		key_list = list(ob.keys())
		pos = k.index(p)
		print(key_list[pos])
	else:
		print('CONFUSED')


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = list(range(1, 11))
	a = []
	for i in l1:
		a.append(l.count(i))
	if a.count(max(a)) > 1:
		print('CONFUSED')
	else:
		print(l1[a.index(max(a))])


for i in range(int(input())):
	N = int(input())
	li = list(map(int, input().split()))
	newli = []
	countli = []
	for i in li:
		if i not in newli:
			newli.append(i)
			countli.append(li.count(i))
	a = countli.index(max(countli))
	if countli.count(max(countli)) == 1:
		print(newli[a])
	else:
		print('CONFUSED')


import statistics
from statistics import mode
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	M = mode(l)
	c = l.count(M)
	count = 0
	s = set(l)
	l1 = list(s)
	for i in range(len(l1)):
		c1 = l.count(l1[i])
		if c1 == c:
			count = count + 1
	if count > 1:
		print('CONFUSED')
	else:
		print(M)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	m = l[0]
	for j in l:
		d[j] = d.get(j, 0) + 1
		if d[j] > d[m]:
			m = j
	cnt = 0
	for j in d.keys():
		if d[j] == d[m]:
			cnt += 1
	if cnt == 1:
		print(m)
	else:
		print('CONFUSED')


t = int(input())
for _ in range(t):
	n = int(input())
	recom = list(map(int, input().split()))
	laptop = [0] * 10
	max_count = 0
	for i in range(n):
		laptop[recom[i] - 1] += 1
		if laptop[recom[i] - 1] > laptop[max_count]:
			max_count = recom[i] - 1
	laptop.sort()
	if laptop[8] == laptop[9]:
		print('CONFUSED')
	else:
		print(max_count + 1)


from collections import Counter
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	k = []
	c = Counter(l)
	h = max(c.values())
	for i in c.values():
		k.append(i)
	if k.count(max(k)) > 1:
		print('CONFUSED')
	else:
		for i in c:
			if c[i] == h:
				print(i)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	af = [0 for k in range(11)]
	for j in a:
		af[j] += 1
	m = 0
	k = 0
	for j in range(1, 11):
		if af[j] > m:
			m = af[j]
			k = j
			continue
		if af[j] != 0 and af[j] == m:
			k = -1
	if k == -1:
		print('CONFUSED')
	else:
		print(k)


from collections import Counter
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = Counter(l)
	count = 0
	x = max(d.values())
	for i in d.values():
		if i == x:
			count += 1
	if count > 1:
		print('CONFUSED')
	else:
		for i in d:
			if d[i] == x:
				print(i)
				break


from collections import Counter
t = int(input())
for tc in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k = Counter(a)
	c = 0
	x = max(k.values())
	for j in k.values():
		if j == x:
			c += 1
	if c > 1:
		print('CONFUSED')
	else:
		for j in k:
			if k[j] == x:
				print(j)
				break


t = int(input())
while t > 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	list3 = []
	m = 0
	val = 0
	f = 0
	fl = 0
	for i in list1:
		if i not in list3:
			list3.append(i)
			c = list1.count(i)
			if f == 0:
				m = c
				f = 1
				val = i
			elif c > m:
				m = c
				val = i
				fl = 0
			elif c == m:
				fl = 1
	if fl == 1:
		print('CONFUSED')
	else:
		print(val)
	t = t - 1


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		laptops = list(map(int, input().split()))
		laptop_count = [0] * 11
		for laptop in laptops:
			laptop_count[laptop] += 1
		max_recommendation = max(laptop_count)
		max_laptops = [index for (index, count) in enumerate(laptop_count) if count == max_recommendation]
		if len(max_laptops) > 1:
			print('CONFUSED')
		else:
			print(max_laptops[0])
main()


from statistics import mode
for _ in range(int(input())):
	friends = int(input())
	recommendations = list(map(int, input().split()))
	modevalue = mode(recommendations)
	countmax = recommendations.count(modevalue)
	counted = []
	a = 1
	for i in recommendations:
		if i not in counted:
			if recommendations.count(i) == countmax and i != modevalue:
				a = 0
				break
			else:
				counted.append(i)
	if a == 0:
		print('CONFUSED')
	else:
		print(modevalue)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in a:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	c = 0
	x = max(d.values())
	for i in d.values():
		if i == x:
			c += 1
	if c > 1:
		print('CONFUSED')
	else:
		for i in d:
			if d[i] == x:
				print(i)
				break


def solve(l):
	d = {}
	for i in l:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	mx = 0
	key = 0
	for i in d:
		if d[i] > mx:
			mx = d[i]
			key = i
	ct = 0
	for i in d:
		if d[i] == mx:
			ct += 1
	if ct == 1:
		return key
	return 'CONFUSED'
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(solve(l))


import array
for i in range(int(input())):
	n = int(input())
	arr = input().split()
	count_arr = [0] * 10
	for i in range(n):
		count_arr[int(arr[i]) - 1] += 1
	if count_arr.count(max(count_arr)) > 1:
		print('CONFUSED')
	else:
		for j in range(10):
			if count_arr[j] == max(count_arr):
				ans = j + 1
				break
		print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = [[a.count(i), i] for i in set(a)]
	if len(l) == 1:
		print(l[0][1])
	else:
		l.sort()
		if l[-1][0] == l[-2][0]:
			print('CONFUSED')
		else:
			print(l[-1][1])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	m = set(l)
	fin = []
	for i in m:
		x = l.count(i)
		fin.append(x)
	y = max(fin)
	if fin.count(y) > 1:
		print('CONFUSED')
	else:
		for i in l:
			if l.count(i) == y:
				print(i)
				break


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(x) for x in input().split(' ', n - 1)]
	s = set(l)
	l1 = list(s)
	l2 = []
	for i in range(len(l1)):
		l2.append(l.count(l1[i]))
	a = max(l2)
	if l2.count(a) > 1:
		print('CONFUSED')
	else:
		print(l1[l2.index(a)])


for t in range(int(input())):
	n = int(input())
	d = {}
	a = list(map(int, input().split()))
	for i in a:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	answer = 0
	value = 0
	count = 0
	val = list(zip(d.keys(), d.values()))
	for m in val:
		if m[1] > value:
			value = m[1]
			answer = m[0]
			count = 0
		elif m[1] == value:
			count += 1
	if count >= 1:
		print('CONFUSED')
	else:
		print(answer)


T = int(input())
for tcase in range(T):
	N = int(input())
	l = [int(x) for x in input().split()]
	d = {}
	for i in l:
		d.update({i: l.count(i)})
	l1 = list(d.values())
	s2 = {x for x in d if d[x] == max(l1)}
	if len(s2) > 1:
		print('CONFUSED')
	else:
		for i in s2:
			print(i)


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	(d, c) = ({}, 0)
	for i in A:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	l = [value for value in d.values()]
	l.sort()
	maxi = l[-1]
	if l.count(maxi) == 1:
		for (key, value) in d.items():
			if maxi == value:
				print(key)
	else:
		print('CONFUSED')


for x in range(int(input())):
	a = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	b = []
	c = []
	for y in s:
		b.append(l.count(y))
		c.append(y)
	if b.count(max(b)) > 1:
		print('CONFUSED')
	else:
		print(c[b.index(max(b))])


def laptop():
	hash = [0] * 11
	for i in a:
		hash[i] += 1
	sort = sorted(hash)
	if sort[-1] == sort[-2]:
		return 'CONFUSED'
	else:
		return hash.index(max(hash))
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	print(laptop())


def laptop():
	unique = set(a)
	d = {}
	for i in unique:
		d.update({i: a.count(i)})
	val = list(d.values())
	max1 = max(val)
	key = list(d.keys())
	if val.count(max(val)) > 1:
		return 'CONFUSED'
	else:
		for i in key:
			if d[i] == max1:
				return i
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	print(laptop())


t = int(input())
while t != 0:
	t = t - 1
	n = int(input())
	arr = list(map(int, input().split()))
	lappy = [0] * 11
	ax = 0
	elem = 0
	for i in range(11):
		lappy[i] = arr.count(i)
		if ax < lappy[i]:
			ax = lappy[i]
			elem = i
	flag = True
	for i in range(11):
		if lappy[i] == ax and i != elem:
			flag = False
	if flag:
		print(elem, end='\n')
	else:
		print('CONFUSED')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in a:
		if i not in d:
			d[i] = 1
		else:
			d[i] = d[i] + 1
	max1 = 0
	k = 0
	flag = 0
	for i in d.keys():
		if d[i] > max1:
			max1 = d[i]
			k = i
			flag = 0
		elif d[i] == max1:
			flag = 1
	if flag == 0:
		print(k)
	else:
		print('CONFUSED')


T = int(input())
for i in range(T):
	N = int(input())
	A = input().split()
	if len(A) == N:
		d = {}
		for x in A:
			d[x] = d.get(x, 0) + 1
		a = max(d.values())
		l = []
		for (i, j) in d.items():
			if j == a:
				l.append(i)
		if len(l) > 1:
			print('CONFUSED')
		else:
			print(l[0])


T = int(input())
for i in range(T):
	x = int(input())
	recom = list(map(int, input().split()))
	p = []
	for i in recom:
		if i not in p:
			p.append(i)
	y = len(p)
	c = 0
	g = 0
	newlist = []
	for i in p:
		c2 = recom.count(i)
		newlist.append(c2)
	for i in p:
		c1 = recom.count(i)
		if c1 > c:
			c = c1
			d = i
	x = newlist.count(c)
	if x > 1:
		print('CONFUSED')
	else:
		print(d)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	(l1, l2) = ([], [])
	for x in s:
		l1.append(x)
		l2.append(l.count(x))
	res = max(l2)
	if l2.count(res) > 1:
		print('CONFUSED')
	else:
		for (x, y) in zip(l1, l2):
			if y == res:
				print(x)
				break


for i in range(int(input())):
	num = int(input())
	list1 = list(map(int, input().split()))
	dict1 = {}
	for j in list1:
		dict1[j] = list1.count(j)
	if list(dict1.values()).count(max(list(dict1.values()))) > 1:
		print('CONFUSED')
	else:
		print(list(dict1.keys())[list(dict1.values()).index(max(list(dict1.values())))])


T = int(input())
for i in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	S = set(A)
	L = list(S)
	c = []
	for j in L:
		C = A.count(j)
		c.append(C)
	I = c.index(max(c))
	if c.count(max(c)) > 1:
		print('CONFUSED')
	else:
		print(L[I])


T = int(input())
for _ in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	p = []
	for i in l:
		if i not in p:
			p.append(i)
	c = 0
	for j in p:
		if l.count(j) > c:
			c = l.count(j)
			s = j
		elif l.count(j) == c:
			s = 'CONFUSED'
	print(s)


for i in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	b = []
	for i in set(li):
		b.append(li.count(i))
	if b.count(max(b)) > 1:
		print('CONFUSED')
	else:
		for i in set(li):
			if li.count(i) == max(b):
				print(i)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	c = Counter(arr)
	count_1 = list(Counter(arr).values())
	maximum = max(list(count_1))
	x = count_1.count(maximum)
	if x == 1:
		for ele in c:
			if c[ele] == maximum:
				break
		print(ele)
	else:
		print('CONFUSED')


import statistics
for i in range(int(input())):
	n = input()
	a = list(map(int, input().split()))
	s = set(a)
	seen = []
	for j in s:
		seen.append(a.count(j))
	if seen.count(max(seen)) > 1:
		print('CONFUSED')
	else:
		print(statistics.mode(a))


for _ in range(int(input())):
	N = int(input())
	from collections import Counter
	l = Counter(list(map(int, input().split())))
	ans = sorted(l.items(), key=lambda x: x[1])
	if len(ans) == 1:
		print(ans[0][0])
	elif ans[-1][1] == ans[-2][1]:
		print('CONFUSED')
	else:
		print(ans[-1][0])


n = int(input())
for i in range(n):
	t = int(input())
	(s, ss) = ([], {})
	(a, aa) = ([], [])
	s = list(map(int, input().split()))
	s.sort()
	se = set(s)
	li = list(se)
	for j in range(0, len(li)):
		co = s.count(li[j])
		ss[co] = li[j]
		aa.append(co)
	aa.sort()
	a = aa[::-1]
	if len(aa) > 1:
		if a[0] == a[1]:
			print('CONFUSED')
		else:
			m = a[0]
			print(ss[m])
	else:
		m = a[0]
		print(ss[m])