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 isprime(b):
    Min = 2  # 范围最小值
    Max = 10000000  # 范围最大值
    Loop = 0  # 计算循环次数
    Result = []  # 结果
    Natural = [True for P in range(Max)]  # 自然数列表标记为True
    for P in range(2, Max):
        if Natural[P]:  # 标记如果为True，就是质数
            if P >= Min:
                Result.append(P)  # 添加范围之内的质数
            for N in range(P*2, Max, P):   # 将质数的倍数的标记改为False
                Loop += 1
                Natural[N] = False
    for i in Result:
        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:
        num = 1
        isprime(b)
    else:
        tag = "NO"
    ans.append(tag)
for i in ans:
    print(i)