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.
import math
def euler_sieve(x):
    is_Prime=[True]*x
    Prime=[2]
    p=3 # start from an odd number
    while p<=x:
        if is_Prime[p-1]:
            Prime.append(p)
            m=p*p # use a variable m to store the value of n*p
            while m<=x:
                is_Prime[m-1]=False
                m+=p*2 # increment m by p times 2 using bitwise operation
        p+=2 # increment p by 2 to skip even numbers
    return Prime

n=int(input())
numbers=list(map(int,input().split()))
number_max=math.ceil(math.sqrt(max(numbers)))
primes=euler_sieve(number_max)
for i in numbers:
    if i==1:
        print('NO')
    else:
        if math.sqrt(i) in primes:
            print('YES')
        else:
            print('NO')