linnum_36619
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 i^th 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 ≤ 10^200
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.
for _ in range(input()):
	n=input()
	a=raw_input().split()
	x=raw_input()
	b=[0]*n
	#n=a[0].count(x)
	#print n
	for i in range(n):
		c=a[i].count(x)
		b[i]=c
	m=max(b)
	#print b
	for i in range(n):
		if b[i]==m:
			print a[i]
			break
2
5
345 1323 165 98 456
3
5
335 876 98 1323 349
3 2
5
345 1323 165 98 456
3
5
335 876 98 1323 349
4 2
5
345 1323 257 98 456
3
5
335 876 98 1323 474
4 2
5
345 1683 216 98 456
3
5
335 876 98 1323 474
4 2
5
345 1079 216 55 456
3
5
335 746 101 1323 474
1 2
5
345 1079 216 55 456
3
2
335 746 101 1323 474
1 2
5
345 1079 216 55 456
3
2
335 1107 101 1323 474
1 2
5
345 1079 216 55 81
3
1
66 883 101 92 474
1 2
2
388 1079 203 55 81
3
1
66 883 101 92 519
1 2
5
345 1323 165 98 456
3
5
335 876 98 1360 349
3 2
5
345 1079 216 55 456
3
5
335 746 001 1323 474
1 2
5
345 1079 216 55 456
3
1
326 883 101 1323 474
1 2
5
345 1079 216 55 81
3
1
122 883 101 1323 474
1 2
5
345 1079 216 55 81
3
1
32 883 101 92 474
1 2
2
383 1079 203 55 81
3
1
66 883 101 92 519
1 2
5
345 1079 216 98 456
3
5
26 746 98 1323 474
3 2
5
345 1079 216 66 456
3
2
335 746 111 1323 474
4 2
5
635 1079 216 55 81
3
1
122 883 101 1323 474
1 2
5
345 1079 216 98 456
3
5
26 746 98 2435 474
3 2
5
345 1079 216 55 81
3
1
29 883 101 55 474
1 2
2
457 1079 203 55 81
3
1
66 883 101 92 390
1 2
5
345 1323 257 125 456
3
5
39 1581 98 1323 349
1 2
5
345 1683 216 167 456
4
5
335 440 98 1323 474
4 2
3
23 1084 216 55 456
3
2
335 1107 101 1323 396
1 2
5
345 1079 216 55 81
3
1
33 883 101 55 474
1 2
5
345 1062 216 98 414
4
5
383 222 98 1323 474
4 2
5
125 1079 216 55 1071
3
2
335 746 101 2284 261
1 2
3
457 1079 203 55 81
3
1
66 883 101 92 766
1 2
5
632 1079 216 127 456
3
5
26 885 98 2435 474
3 2
5
345 1760 216 66 456
3
2
159 886 111 1323 139
4 2
5
345 1079 294 66 456
1
1
326 883 100 1323 474
0 2
5
345 1079 216 33 81
3
1
33 883 101 55 474
1 2
2
345 2233 165 98 747
3
5
335 1113 98 1360 421
3 2
5
345 1675 474 125 456
3
5
39 1581 98 512 349
1 2
5
345 1431 294 66 456
1
1
326 883 100 1323 474
0 2
5
345 1062 216 98 97
7
5
383 222 139 1323 474
4 2
5
345 774 277 55 341
2
1
335 708 001 1555 474
2 2
5
500 1675 474 125 456
3
5
39 1581 98 664 349
1 2
5
345 1760 216 66 456
0
4
159 886 101 1323 139
4 2
5
125 1079 216 99 852
3
2
1 746 101 2284 261
1 2
2
508 2233 165 98 747
0
5
335 388 98 1360 691
3 2
5
125 1062 216 98 97
7
5
383 222 142 1323 840
4 2
5
63 1079 118 99 852
3
2
1 746 001 2284 261
1 2
1
345 2084 165 55 81
6
1
35 883 001 248 175
1 2
3
626 877 25 164 77
3
2
335 685 57 1323 331
4 2
5
500 1675 474 125 456
3
5
39 1581 127 1294 568
0 2
5
125 1062 216 98 97
7
5
383 222 142 1323 840
2 2
5
345 1760 216 66 178
0
4
159 1388 101 4 139
4 2
3
626 877 25 164 77
5
2
335 685 57 1323 331
4 2
5
500 1675 474 125 456
3
5
39 1702 127 1294 568
0 2
3
508 2233 165 98 747
0
5
495 406 1 1360 691
3 2
5
500 1675 474 125 456
3
5
39 3282 127 1294 568
1 2
3
508 2233 165 98 747
0
5
495 406 1 574 691
3 2
5
345 1760 280 66 178
0
4
159 1834 100 7 139
4 2
5
125 1824 216 98 57
7
5
383 222 142 717 1469
2 2
5
254 774 451 77 341
-1
1
335 708 011 1798 927
2 2
5
125 1824 216 98 57
7
5
383 327 142 717 1469
2 2
5
345 1760 280 66 178
0
4
296 471 100 7 139
4 2
5
29 1079 138 99 713
3
1
1 1340 001 2284 261
0 2
5
125 1824 216 98 57
12
5
383 327 190 717 1469
2 2
1
345 1760 280 66 178
0
4
296 471 100 7 277
4 2
5
29 643 138 99 713
3
1
1 1340 001 2284 261
0 2
5
254 774 451 77 341
0
1
18 708 011 1849 927
2 2
5
125 1824 216 98 57
12
5
383 327 190 717 1469
4 2
3
23 536 370 108 134
3
2
435 1028 100 3176 782
0 2
3
23 536 370 108 134
3
2
435 193 100 3176 782
0 2
3
626 877 26 234 77
6
2
195 173 57 2224 226
2 2
5
154 1824 53 98 57
12
5
383 327 190 717 1469
4 2
2
508 5311 176 98 831
0
5
495 406 1 574 1169
0 2
3
626 877 26 234 77
6
2
195 24 57 2224 226
2 2
5
29 650 138 162 713
3
2
1 1340 011 2284 261
0 2
5
254 774 451 102 341
0
1
18 2 011 3595 927
2 2
2
508 5311 176 98 831
0
5
495 406 1 574 1169
1 2
5
198 1824 53 98 57
12
5
383 327 190 550 1469
4 2
1
345 1760 280 66 184
0
4
296 690 000 12 164
4 2
5
254 774 451 109 341
0
1
18 2 011 2553 1437
2 2
5
198 1824 53 98 6
12
5
355 145 190 550 1469
4 2
2
508 5420 176 98 831
0
5
495 406 1 254 1169
2 2
1
345 1760 280 101 184
0
2
347 690 000 12 164
4 2
3
626 877 39 234 77
1
2
144 33 74 710 226
2 2
4
20 650 138 162 1327
3
3
1 1090 011 2035 261
0 2
3
42 21 370 143 134
3
2
435 193 001 1635 782
0 2
5
198 1824 34 98 6
12
5
355 34 70 550 1469
4 2
4
20 650 138 162 1327
3
3
0 1807 011 2035 261
0 2
2
6 5420 176 21 725
0
5
495 406 1 254 33
2 2
1
345 1760 280 101 333
0
2
347 690 000 11 56
0 2
3
626 877 39 234 77
1
4
144 33 74 1462 226
2 2
4
20 650 138 162 1327
5
3
0 1696 011 2035 261
0 2
1
345 1760 280 101 333
0
3
493 690 100 11 56
0 2
5
42 21 370 143 134
3
4
404 193 001 2907 782
-1 2
5
42 21 618 143 134
3
4
404 78 001 2907 782
-1 2
1
345 1760 66 101 333
1
3
493 1309 110 11 56
0 2
5
42 17 618 143 134
4
4
404 78 001 2907 782
-1 2
5
30 650 138 162 255
5
3
0 1696 111 3039 261
-1 2
5
42 17 618 143 134
8
4
404 78 001 2907 782
-1 2
3
215 569 43 195 94
0
4
86 33 74 1462 225
2 2
5
30 650 138 162 110
5
3
-1 1696 111 3039 261
-1 2
5
30 650 138 162 110
4
3
-1 1696 111 3039 261
-1 2
5
30 650 138 162 110
4
3
0 1696 111 3039 261
-1 2
3
30 650 469 162 110
4
3
-1 1696 111 3039 261
-1 2
3
29 650 671 162 110
4
3
-1 1696 111 3039 261
-1
1323
335 1323
349
 1323
474
 345
474
 345
101
 345
335
 345
1107
 345
66
 388
66
 1323
335
 345
001
 345
326
 345
122
 345
32
 383
66
 345
1323
 345
746
 635
122
 345
2435
 345
29
 457
66
 1323
1581
 345
440
 23
1107
 345
33
 414
474
 125
335
 203
66
 632
2435
 345
159
 1079
326
 33
33
 2233
335
 345
1581
 1431
326
 97
474
 277
335
 500
1581
 1760
159
 125
1
 508
335
 97
142
 63
1
 345
35
 626
335
 500
39
 97
222
 1760
4
 25
335
 500
1702
 508
1360
 500
127
 508
495
 1760
1834
 57
222
 254
335
 57
327
 1760
471
 138
1
 125
327
 345
471
 643
1
 254
18
 125
1469
 23
1028
 23
435
 626
195
 154
1469
 508
406
 626
24
 138
1340
 102
18
 508
1169
 198
1469
 345
296
 109
18
 198
145
 508
254
 345
347
 626
144
 138
1090
 370
435
 198
34
 138
0
 5420
254
 345
690
 626
1462
 650
0
 345
100
 370
404
 143
404
 345
1309
 42
404
 255
0
 618
404
 215
1462
 650
-1
 30
-1
 30
0
 469
-1
 29
-1
