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.
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 14 18:00:48 2023

@author: MARIA
"""

# T-Primes

def criba(n):
    primes = [1 for i in range(n+1)] # n+1 para que tome el n
    
    num = 2
    for i in range(2,n):
        while num*i<n:
            if primes[num*i]==1:
                primes[num*i]=0
            num+=1
    primos  = []
    for i in range(n):
        if primes[i]==1:
            primos.append(i)
    return primos[2:]

def binarySearch(A,candidato,pos_start,pos_end):
    while pos_start<=pos_end:
        mid = (pos_end + pos_start)//2
        if A[mid]==candidato:
            return "YES"
        elif A[mid]>candidato:
            pos_end=mid-1
        else:
            pos_start=mid+1
    return "NO"


primos = criba(1000000)
T_primes = [p**2 for p in primos]

#data
t = int(input())
nums = input().split()
nums = [int(num) for num in nums]

for i in range(t):
    print(binarySearch(T_primes, nums[i], 0, 999999))
    







