a number can be said dual prime. if the number is prime and the sum of digits of the number is also a prime number.
If a number is dual prime then print YES else print NO

SAMPLE INPUT
2
13
11

SAMPLE OUTPUT
NO
YES
import math
def is_prime(n):
    if n % 2 == 0 and n > 2: 
        return False
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        if n % i == 0:
            return False
    return True

def digitsum(n):
    return  sum(map(int,str(n)))

noc = input()
while noc:
    noc-=1
    test = input()
    if is_prime(test) and is_prime(digitsum(test)):
        print "YES"
    else:
        print "NO"