We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer *t* Т-prime, if *t* has exactly three distinct positive divisors.

You are given an array of *n* positive integers. For each of them determine whether it is Т-prime or not.
The first line contains a single positive integer, *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>), showing how many numbers are in the array. The next line contains *n* space-separated integers *x*<sub class="lower-index">*i*</sub> (1 ≤ *x*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">12</sup>).

Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d specifier.
import math
def is_prime(x):
    wheels=[7,11,13,17,19,23,29]
    is_Prime=[]
    for i in range(x):
        if (i+1)%30 in wheels or i==1 or i==2 or i==4:
            is_Prime.append(True)
        else:
            is_Prime.append(False)
    return is_Prime

def euler_sieve(x):
    is_Prime=is_prime(x)
    Prime={2}
    p=3 # start from an odd number
    while p<=x:
        if is_Prime[p-1]:
            Prime.add(p)
            m=p*p #start from p*p because those smaller than this was alreafy calculated
            while m<=x:
                is_Prime[m-1]=False
                m+=p*2 # increment m by p times 2 using bitwise operation
        p+=2 # increment p by 2 to skip even numbers
    return Prime

n=int(input())
numbers=list(map(int,input().split()))
number_max=math.ceil(math.sqrt(max(numbers)))
primes=euler_sieve(number_max)
for i in numbers:
    if i==1:
        print('NO')
    else:
        if math.sqrt(i) in primes:
            print('YES')
        else:
            print('NO')