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.
from math import sqrt
primes=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, \
        101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, \
        211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, \
        307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, \
        401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, \
        503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, \
        601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, \
        701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, \
        809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, \
        907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

def bisearch(l:list,k:int):
    if k<l[0] or k>l[-1]:return False
    n=len(l)
    start,end=0,n-1
    while start<=end:
        mid=(start+end)//2
        if l[mid]==k or l[mid+1]==k: return True
        elif l[mid]<k: start=mid
        else: end=mid
        if end-start<=1 and l[mid]<k<l[mid+1]: return False

def isprime(n:int)->bool:
    global primes
    if n<=primes[-1]: return True if bisearch(primes,n) else False
    else:
        if (s:=int(sqrt(n)))<=primes[-1]:
            for prime in primes:
                if n%prime==0:
                    return False
            return True
        else:
            for i in range(primes[-1]+1,s+1):
                for prime in primes:
                    if n%prime==0: return False
                    if i%prime==0: break
                else: primes.append(i)
            return True

def isTprime(n:int)->bool:
    sq=int(sqrt(n))
    return True if sq*sq==n and isprime(sq) else False
    
n=int(input())
l=list(map(int,input().split()))
for i in range(n): print('YES') if isTprime(l[i]) else print('NO')