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
# 化院 荆屹然 2300011884


def q_mul(multiple_num1, multiple_num2, mod):
    residual = multiple_num1 * multiple_num2 - math.floor(multiple_num1 * multiple_num2 / mod) * mod
    return residual


def q_pow(base, exponent, mod):
    residual = 1
    while exponent:
        if exponent & 1:
            residual = q_mul(residual, base, mod)
        base = q_mul(base, base, mod)
        exponent >>= 1
    return residual


def miller_rabin(num):
    if num == 2:
        return True
    if not num & 1 or num == 1:
        return False
    exponent_num = num - 1
    exponent_2 = 0
    while not exponent_num & 1:
        exponent_2 += 1
        exponent_num >>= 1
    for check_base in check_bases:
        if num % check_base == 0:
            return False
        check_pow = q_pow(check_base, exponent_num, num)
        if check_pow == 1 or check_pow == num - 1:
            continue
        for k in range(0, exponent_2):
            check_pow = q_mul(check_pow, check_pow, num)
            if check_pow == n - 1 and k + 1 != exponent_2:
                check_pow = 1
                break
            if check_pow == 1:
                return False
        if check_pow != 1:
            return False
    return True


def if_t_prime(num: int):
    root = math.floor(math.sqrt(num))
    if root ** 2 == num and miller_rabin(root):
        return True
    else:
        return False


n = int(input())
array = list(map(int, input().split()))
check_bases = (2, 7, 61)
for i in range(0, n):
    if if_t_prime(array[i]):
        print("YES")
    else:
        print("NO")
# 化院 荆屹然 2300011884
