fun-with-primes-3
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

A prime number is one which is divisible by exactly two numbers 1 and itself.
Given a number, find out if the number obtained by summing all digits of that number is a prime.

Input Format:
The input begins with number of test-cases t in a single line. In each of next tlines there is a number n.

Output Format
In each line print YES if sum of digits of the number is a prime.Otherwise print NO.

t < 100000, 1 < n < 1000000

Example
There are 3 test cases here 32, 51, 101

Input:

3

32

51

101

Output

YES

NO

YES

Explanation

Number of test cases t = 3

32 -> 3 + 2 = 5 . Since 5 is a prime , we print YES

51 -> 5 + 1 = 6 . Since 6 is not a prime , we print NO

101 ->1+0+1 = 2 . Since 2 is a prime , we print YES

SAMPLE INPUT
2
33
122

SAMPLE OUTPUT
NO
YES


def isPrime(n):
	if n < 2: 
		 return False;
	if n % 2 == 0:
		 return n == 2
	k = 3
	while k*k <= n:
		 if n % k == 0:
			 return False
		 k += 2
	return True
for _ in range(int(input())):
	if isPrime(sum(map(int, input()))):
		print("YES")
	else:
		print("NO")


dp=[1]*101
def main():
	dp[0]=0
	dp[1]=0
	for i in range(2,10):
		if(dp[i]==1):
			j=i*i
			while(j<=100):
				dp[j]=0
				j=j+i
def sum(n):
	ans=0
	while(n>0):
		ans+=n%10
		n=n/10
	return ans
main()
t=int(input())
while(t>0):
	n=int(input())
	x=sum(n)
	if(dp[x]==1):
		print("YES")
	else:
		print("NO")
	t=t-1
		


t=eval(input())
for i in range(t):
	n=input()
	s=0
	for j in n:
		k=int(j)
		s=s+k
	if s!=1:
		for l in range(2,s):
			if s%l==0:
				print("NO")
				break
		else:
			print("YES")
	else:
		print("NO")
		


def digsum(n):
	s=0
	while n>0:
		s=s+n%10
		n=int(n/10)
	return s
tc=int(eval(input()))
primes=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]
while tc>0:
	s=int(eval(input()))
	if digsum(s) in primes:
		print('YES')
	else:
		print('NO')
	tc=tc-1