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

def ouLaShai(n):
    lis = [True for  i in range(n + 1)]
    #  用于筛选记录合数
    lis2 = []
    #  存质数
    for i in  range(2, n + 1):
        if lis[i]:
            #  如果没有被筛选就加到Lis2
             lis2.append(i)
        for prime  in lis2:
            if i *  prime > n:
                #  保证小于n，不能超出范围
                 break
            lis[i *  prime] = False
            #  记录合数
            if i %  prime == 0:
                 #  关键步骤，确保每个合数只被筛选一次
                 break
    for i in lis2:
        if n % i == 0:
            tag = "NO"
            break
n = int(input())
list1 = list(map(int,input().split()))
ans=[]
for i in list1:
    tag = "YES"
    a = sqrt(i)
    b = int(a)
    if i == 1:
        tag = "NO"
    elif i == 4:
        tag = "YES"
    elif a == b and b%2 == 0:
        tag = "NO"
    elif a == b:
        ouLaShai(b)
    else:
        tag = "NO"
    ans.append(tag)
for i in ans:
    print(i)