Given a positive integer N, MoEngage wants you to determine if it is possible to rearrange the digits of N (in decimal representation) and obtain a [multiple] of 5. 

For example, when N = 108, we can rearrange its digits to construct 180 = 36 \cdot 5 which is a multiple of 5.

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

- The first line contains an integer T, the number of test cases. The description of the T test cases follow.
- Each test case consists of two lines
- The first line contains a single integer D, the number of digits in N.
- The second line consists of a string of length D, the number N (in decimal representation). It is guaranteed that the string does not contain leading zeroes and consists only of the characters 0, 1, \dots 9.

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

- For each test case, print \texttt{Yes} if it is possible to rearrange the digits of N so that it becomes a multiple 5. Otherwise, print \texttt{No}.

You may print each character of the string in uppercase or lowercase (for example, the strings \texttt{YeS}, \texttt{yEs}, \texttt{yes} and \texttt{YES} will all be treated as identical).

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

$1 ≤ T ≤ 1000$
$1 ≤ D ≤ 1000$
$1 ≤ N < 10^{1000}$
- Sum of $D$ over all test cases $≤ 1000$.

----- Sample Input 1 ------ 
3
3
115
3
103
3
119
----- Sample Output 1 ------ 
Yes
Yes
No
----- explanation 1 ------ 
Test Case $1$: The given number is already divisible by $5$, therefore the answer is $\texttt{Yes}$.

Test Case 2: We can obtain $310 = 62 \cdot 5$ by rearranging the digits of $103$, so the answer is $\texttt{Yes}$.

Test Case 3: The only numbers that can be obtained by rearranging the digits of $119$ are $\{119, 191, 911\}$. None of these numbers are multiples of $5$, so the answer is $\texttt{No}$.

Difficulty: EASY
Tags: String algorithms

Data structures
Skill types: Data structures

Starter code:

Solutions:
for i in range(int(input())):
	n = int(input())
	num = input()
	c = 0
	l = ['0', '5']
	for i in num:
		if i in l:
			print('Yes')
			c += 1
			break
	if c == 0:
		print('No')


for i in range(int(input())):
	n = int(input())
	d = input()
	c = 0
	for j in d:
		if j == '5' or j == '0':
			c = 1
	if c == 1:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	n = int(input())
	s = input()
	for i in s:
		if i == '0' or i == '5':
			print('Yes')
			break
	else:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	str = input()
	c = 0
	for i in range(n):
		if int(str[i]) == 0 or int(str[i]) == 5:
			c = 1
	if c == 0:
		print('No')
	else:
		print('Yes')


t = int(input())
for i in range(t):
	n = int(input())
	m = input()
	s = '05'
	c = 0
	for i in m:
		if i in s:
			c = 1
	if c == 1:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	str_1 = input()
	if '5' in str_1 or '0' in str_1:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	c = 0
	a = int(input())
	l = list(input())
	for j in range(a):
		if int(l[j]) == 5 or int(l[j]) == 0:
			c = 1
	if c == 1:
		print('Yes')
	else:
		print('No')


for t in range(int(input())):
	digits = int(input())
	number = input()
	if '0' in number or '5' in number:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	d = int(input())
	n = input()
	if '5' in n or '0' in n:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	N = int(input())
	D = input()
	count = 0
	for i in D:
		if i == '0' or i == '5':
			count = count + 1
	if count > 0:
		print('Yes')
	else:
		print('No')


n = int(input())
while n != 0:
	x = int(input())
	z = int(input())
	if x == 0:
		print('No')
	else:
		s = str(z)
		k = s.count('0')
		a = s.count('5')
		if k >= 1 or a >= 1:
			print('Yes')
		else:
			print('No')
	n = n - 1


n = int(input())
for i in range(n):
	a = int(input())
	k = int(input())
	c = 0
	while k > 0:
		d = k % 10
		if d == 5 or d == 0:
			c = c + 1
		k = k // 10
	if c > 0:
		print('Yes')
	else:
		print('No')


n = int(input())
for i in range(n):
	s = int(input())
	l = input()
	if '5' in l:
		print('Yes')
	elif '0' in l:
		print('Yes')
	else:
		print('No')


n = int(input())
for i in range(n):
	a = int(input())
	b = input()
	if '5' in b or '0' in b:
		print('Yes')
	else:
		print('No')