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.
def euler_sieve(n): #欧拉筛
    prime = [True] * (n + 1)
    primes = []

    for p in range(2, n + 1): #从2到限定范围

        if prime[p]: #2已经被赋值[True]，直接进入if
            primes.append(p) #2是质数
        for i in range(len(primes)): #遍历已经加入primes列表中的数
            if p * primes[i] > n: #如果倍数超出数据范围，提前break
                break
            prime[p * primes[i]] = False #质数的倍数不是质数
            if p % primes[i] == 0: # p是质数之一的倍数
                break

    return primes



n=int(input())
l=list(map(int,input().split()))

sieve_result=euler_sieve(1000000)

def is_tprime(n):
    sqrt_n=n**0.5
    return sqrt_n * sqrt_n==n and sqrt_n in sieve_result

for i in l:
    print('YES' if is_tprime(i) else 'NO')
