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.
# 2300015804
n = int(input())
is_prime, ans = {0:"NO", 1:"NO"}, {}
m = 0
nums = [int(x) for x in input().split()]        #录入数据
for a in range(n):                              #初步判断，排除非平方数
    if nums[a] in ans:  continue
    if (nums[a] ** 0.5) % 1 == 0:
        ans[nums[a]] = "YES"
        m = max(m, int(nums[a] ** 0.5))         #确定质数列要到哪
    else:   ans[nums[a]] = "NO"

for i in range(2, m + 1):                       #构造质数列
    if i in is_prime:   continue
    is_prime[i] = "YES"
    for now in range(i * i, m, i):
        is_prime[now] = "NO"

for j in range(n):                              #进一步判断
    if ans[nums[j]] == "YES":    ans[nums[j]] = is_prime[int(nums[j] ** 0.5)]

for k in range(n):
    print(ans[nums[k]])