Amit Chahal has a pious love for all kind of fruit juices. Almost every day ,he buys One litre pack of juice. For past one month , Amit Chahal is having a very bad time. One day while he was on a date, he Reverse Peristalsis . Amit Chahal  guessed it is probably due to juices he has been drinking for a while.
Amit Chahal told his problem to Dhruv Katyal (Popularly known as DK). Not many people in NIT are aware of the fact that Dhruv is also an astrologer and an expert in face reading. Dhruv told him that he should be carefull while buying juices. He should only buy those packets whose MRP is a Good Number. Amit Chahal decided to strictly follow the advice of Dhruv because don't want to get embarrassed again when he is on date.
A Good Number is that number whose digits when added together produce a prime number.

Input : First line will contain an integer t, the number of test cases. Description of each test case follow. Each test case consists of only one line telling the MRP of a packet of juice.

Output : For each testcase, print "YES" in a newline if Amit Chahal should buy that juice. "NO" otherwise. Quotes for clarity only.

Constraints :
1 ≤ t ≤ 10
1 ≤ MRP ≤ 10^1000
The price is so huge because it is in the currency of Zimbabwe.

Problem Setter : Abhishek Azad
Problem Tester :Faraz Ghazi

SAMPLE INPUT
3
22
3
7

SAMPLE OUTPUT
NO
YES
YES
def isprime(number):
 if number==2:
  return 1
 if number%2==0: 
  return 0
 N=number**0.5
 i=3
 while i<=N:
  if number%i==0:
   return 0
  i=i+2
 return 1

def main():
 for t in range(input()):
  number=long(raw_input())
  summ=0
  while number>0:
   summ=summ+number%10
   number=number/10
  if isprime(summ)==1:
   print "YES"
  else:
   print "NO"
main()