Stuart is obsessed to numbers. He like all type of numbers in fact he is having a great collection of numbers in his room. His collection includes N different large numbers. But today he is searching for a number which is having maximum frequency of digit X. Numbers are large so he can’t do the task on his own. Help him to find a number having maximum frequency of digit X.

-----Input-----
First Line contains number of test cases T. First Line of each test case contains N. Next line contains N space separated integers A1,A2,A3,....,AN. Where Ai integer indicates ith number in Stuart's room. Next Line contains digit X.

-----Output-----
Output the number which is having maximum frequency of digit X. If two or more numbers are having same maximum frequency then output the first occurred number among them in A1,A2,A3,....,AN

-----Constraints-----
- 1 ≤ T ≤ 30
- 1 ≤ N ≤ 100
- 1 ≤ Ai ≤ 10200
- 0 ≤ X ≤ 9

-----Example-----
Input:
2
5
345 1323 165 98 456
3
5
335 876 98 1323 349
3

Output:
1323
335

-----Explanation-----
Example case 1. 1323 number is having maximum occurrence of digit 3.
Example case 2. 335 & 1323 are having maximum occurrence of digit 3 so output must be first occurred number in the array i.e. 335.

Difficulty: UNKNOWN_DIFFICULTY

Starter code:

Solutions:
T = int(input())

def call_me(N, A, X):
	max = 0
	ans = ''
	for i in A:
		if i.count(X) > max:
			max = i.count(X)
			ans = i
	return ans
for i in range(T):
	N = int(input())
	A = list(map(str, input().split()))
	X = input()
	print(call_me(N, A, X))


for _ in range(int(input())):
	n = int(input())
	a = input().split()
	x = input()
	lis = []
	for i in range(n):
		count = 0
		for j in range(len(a[i])):
			if a[i][j] == x:
				count += 1
		lis.append(count)
	val = max(lis)
	for i in range(len(lis)):
		if lis[i] == val:
			print(a[i])
			break


a = int(input())
while a:
	b = int(input())
	c = str(input()).split()
	d = str(input())
	l = 0
	m = 0
	x = 0
	while b:
		l = c[b - 1].count(d)
		if l >= x:
			x = l
			m = c[b - 1]
		b -= 1
	a -= 1
	print(m)


for t in range(int(input())):
	n = input()
	s = input().split()
	d = input()
	f = 0
	num = 0
	for i in s:
		z = i.count(d)
		if z > f:
			f = z
			num = i
	print(num)


for t in range(eval(input())):
	N = eval(input())
	A = input().split(' ')
	B = eval(input())
	count = [0 for x in range(N)]
	for i in range(N):
		A[i] = list(A[i])
		for j in range(len(A[i])):
			if A[i][j] == str(B):
				count[i] += 1
		A[i] = ''.join(A[i])
	print(A[count.index(max(count))])


tc = int(input())
for i in range(tc):
	m = -1
	n = int(input())
	p = list(map(str, input().split()))
	q = input()
	no = 0
	for j in p:
		if q in j:
			l = j.count(q)
			if m < l:
				m = l
				no = j
	print(no)


t = int(input())
for case in range(t):
	n = int(input())
	a = list(map(str, input().split()))
	k = input()
	max = -1
	for i in a:
		if max < i.count(k):
			max = i.count(k)
			num = i
	print(num)


__author__ = 'ravi'
for i in range(int(input())):
	p = int(input())
	n = input().split()
	c = input()
	mx = 0
	for j in range(p):
		if mx < n[j].count(c):
			mx = n[j].count(c)
	for k in n:
		if mx == k.count(c):
			print(k)
			break


for tc in range(int(input())):
	n = int(input())
	a = list(map(str, input().split()))
	k = input()
	cur = -1
	tmp = -2
	for i in a:
		if k in i:
			if i.count(k) > cur:
				cur = i.count(k)
				tmp = i
	print(tmp)