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.

Input

The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012).

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.

Output

Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.

Examples

Input

3
4 5 6


Output

YES
NO
NO

Note

The given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Number theory

Sorting

Implementation


Solutions:
N = 1000000
a = [1] * N
a[0] = a[1] = 0
s = set()
for (i, x) in enumerate(a):
	if x:
		s.add(i * i)
		for j in range(i + i, N, i):
			a[j] = 0
n = int(input())
lis = list(map(int, input().split()))
for i in lis:
	print('YES' if i in s else 'NO')


import math
prime = []
numberlist = []
for i in range(2, 1001):
	numberlist.append(i)
while numberlist[0] < 32:
	now = numberlist.pop(0)
	prime.append(now)
	newnumberlist = []
	while numberlist != []:
		next = numberlist.pop(0)
		if next % now != 0:
			newnumberlist.append(next)
	numberlist = newnumberlist
prime = prime + numberlist
N = int(input())
A = list(map(int, input().split()))
for i in range(0, N):
	itistprime = False
	x = int(math.sqrt(A[i]))
	if x * x == A[i]:
		for j in range(0, len(prime)):
			if x % prime[j] == 0:
				if x != prime[j]:
					break
			if j == len(prime) - 1:
				itistprime = True
	if itistprime and x != 1:
		print('YES')
	else:
		print('NO')


from math import sqrt, ceil
t = int(input())
arr = []
primes = []
m = -1
a = list(map(int, input().split()))
for i in a:
	if i > m:
		m = i
sieve = []

def Sieve(m):
	target = 1000001
	for i in range(target + 1):
		sieve.append(1)
	sieve[0] = sieve[1] = 0
	tar = 10001
	for i in range(2, tar + 1):
		if sieve[i] == 1:
			for k in range(i * i, target + 1, i):
				sieve[k] = 0
Sieve(m)
l = len(primes)
for i in a:
	if i == 4:
		print('YES')
		continue
	if i % 2 == 0:
		print('NO')
		continue
	n = i ** 0.5
	if int(n) < n:
		print('NO')
	elif sieve[int(n)] == 1:
		print('YES')
	else:
		print('NO')


import math
N = int(input())
arr = [int(x) for x in input().split()]
n = int(math.sqrt(max(arr)) + 1)
prime = [True for i in range(n + 1)]
p = 2
while p * p <= n:
	if prime[p] == True:
		for i in range(p * 2, n + 1, p):
			prime[i] = False
	p += 1
prime[0] = False
prime[1] = False
for ele in arr:
	c = int(math.sqrt(ele))
	if c * c != ele:
		print('NO')
		continue
	if prime[c]:
		print('YES')
	else:
		print('NO')


(z, zz) = (input, lambda : list(map(int, z().split())))
fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
n = 1000000
a = [1] * n
s = set()
for i in range(2, n):
	if a[i]:
		s.add(i * i)
		for j in range(i * i, n, i):
			a[j] = 0
z()
for i in zzz():
	print(['NO', 'YES'][i in s])


import math

def get_primes(k):
	l = list(range(k + 1))
	primes = []
	for i in range(2, k + 1):
		if l[i] != -1:
			j = l[i]
			primes.append(l[i])
			while l[i] * j <= k:
				l[l[i] * j] = -1
				j += 1 + l[i] % 2
	return primes
my_primes = get_primes(1000000)
my_primes_dict = {i * i: '' for i in my_primes}
answer = []
n = int(input())
array = list(map(int, input().split()))
for number in array:
	if number in my_primes_dict:
		answer.append('YES')
		answer.append('\n')
	else:
		answer.append('NO')
		answer.append('\n')
answer.pop()
print(''.join(answer))


from math import sqrt
n = int(input())
a = list(map(int, input().split()))
l = round(sqrt(10 ** 12)) + 2
primes = [True] * l
primes[0] = False
primes[1] = False
for i in range(l):
	if primes[i]:
		for j in range(i ** 2, l, i):
			primes[j] = False
for num in a:
	number = sqrt(num)
	if num < 4:
		print('NO')
	elif number.is_integer() and primes[int(number)]:
		print('YES')
	else:
		print('NO')


from math import sqrt, floor
primes = [True for _ in range(10 ** 6 + 1)]
p = 2
primes[1] = False
while p * p <= 10 ** 6:
	if primes[p] == True:
		for i in range(p * p, 10 ** 6 + 1, p):
			primes[i] = False
	p += 1
n = int(input())
for i in list(map(int, input().split())):
	s = sqrt(i)
	if s == floor(s):
		if primes[int(s)] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
X = input()
X = X.split(' ')
N = []
for i in range(1000001):
	N.append('NO')
N[1] = 'YES'
for i in range(2, 1000001):
	if N[i] == 'NO':
		for j in range(2 * i, 1000001, i):
			N[j] = 'YES'
for i in range(0, n):
	x = int(X[i])
	y = int(math.sqrt(x))
	if y * y == x and N[y] == 'NO':
		print('YES')
	else:
		print('NO')


def eratosthenes(n):
	sieve = list(range(n + 1))
	sieve[1] = 0
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sieve
n = int(input())
my_list = list(map(int, input().split()))
set_of_answers = set()
for i in eratosthenes(1000000):
	if i != 0:
		set_of_answers.add(i ** 2)
for a in my_list:
	print('YES') if a in set_of_answers else print('NO')


import math

def T_primes(n, prime):
	p = 2
	while p * p < n:
		if prime[p]:
			for i in range(2 * p, n + 1, p):
				prime[i] = 0
		p += 1
n = int(input())
l = [int(i) for i in input().split()]
prime = [1 for a in range(10 ** 6 + 1)]
T_primes(10 ** 6, prime)
for x in l:
	b = math.sqrt(x)
	c = 0
	if b % 1 == 0 and b > 1:
		if prime[int(b)]:
			print('YES')
			c = 1
	if c == 0:
		print('NO')


def SieveOfEratosthenes(n, prime):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
n = int(input())
x = [int(i) for i in input().split()]
s = [True] * (10 ** 6 + 1)
SieveOfEratosthenes(10 ** 6, s)
for i in x:
	if i < 4:
		print('NO')
		continue
	elif int(i ** 0.5) ** 2 != i:
		print('NO')
		continue
	if s[int(i ** 0.5)]:
		print('YES')
	else:
		print('NO')


import math
list1 = []
n = 10 ** 6 + 1
for a in range(2, n):
	list1.append(a)
p = 2
while p < math.sqrt(n) + 1:
	for a in range(pow(p, 2), n, p):
		list1[a - 2] = 0
	p += 1
	while list1[p - 2] == 0 and pow(p, 2) < n:
		p += 1
list2 = []
for a in list1:
	if a != 0:
		list2.append(a)
a = int(input())
y = map(int, input().split())
list3 = []
for num in y:
	if num == 1:
		list3.append('NO')
	else:
		b = int(math.sqrt(num))
		if pow(b, 2) == num:
			if list1[int(b - 2)]:
				list3.append('YES')
			else:
				list3.append('NO')
		else:
			list3.append('NO')
for a in list3:
	print(a)


def get_prime(upper):
	upper += 1
	p = [0] * upper
	primes = [4]
	for i in range(3, upper, 2):
		if p[i]:
			continue
		primes.append(i * i)
		for j in range(i * 2, upper, i):
			p[j] = 1
	return primes
n = int(input())
a = list(map(int, input().split()))
k = int(1000000.0) + 1
t = set(get_prime(k))
for i in range(n):
	if a[i] in t:
		print('YES')
	else:
		print('NO')


def prime_nums_finder(n):
	is_prime = [True for i in range(n + 1)]
	is_prime[0] = False
	for i in range(1, int(n ** 0.5)):
		if is_prime[i]:
			for j in range((i + 1) ** 2 - 1, n, i + 1):
				is_prime[j] = False
	return is_prime
n = int(input())
t_primes = list(map(int, input().split()))
isPrime = prime_nums_finder(int(max(t_primes) ** 0.5))
for i in range(n):
	square_root = int(t_primes[i] ** 0.5)
	if square_root * square_root == t_primes[i]:
		if isPrime[square_root - 1]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
primes = []
step = 1000000
sieve = [0] * step
for i in range(2, step):
	if not sieve[i]:
		primes.append(i)
		for j in range(i * i, step, i):
			sieve[j] = 1
s = set((x * x for x in primes))
for x in l:
	print('YES' if x in s else 'NO')


n = int(input())
l = list(map(int, input().split()))
N = 10 ** 6 + 1
k = [True] * N
a = set()
for i in range(2, N):
	if k[i]:
		a.add(i ** 2)
		for j in range(i, N, i):
			k[j] = False
for i in l:
	if i in a:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
from math import sqrt

def is_prime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solution(n, nums):
	for x in nums:
		if int(sqrt(x)) ** 2 == x and is_prime(int(sqrt(x))):
			write('YES')
		else:
			write('NO')

def main():
	n = r_int()
	nums = r_array()
	solution(n, nums)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
n = int(input())
prime = sieve(1000001)
a = [int(x) for x in input().split()]
ans = ['NO'] * n
for i in range(n):
	if a[i] == 1:
		continue
	x = a[i] ** 0.5
	if a[i] % x == 0:
		if prime[int(x)] == True:
			ans[i] = 'YES'
print('\n'.join((str(i) for i in ans)))


z = int(input())
x = [int(i) for i in input().split()]
s = []
prime = [1 for i in range(10 ** 6 + 1)]
p = 2
while p * p < 10 ** 6:
	if prime[p] == 1:
		for i in range(p * 2, 10 ** 6 + 1, p):
			prime[i] = 0
	p += 1
for i in x:
	if i < 4:
		s.append('NO')
		continue
	elif int(i ** 0.5) ** 2 != i:
		s.append('NO')
		continue
	elif prime[int(i ** 0.5)] == 1:
		s.append('YES')
	else:
		s.append('NO')
for i in s:
	print(i)


import math

class prnum:

	def calprnum(n):
		prime = [2, 3, 5]
		for i in range(6, n + 1):
			for j in prime:
				if i % j == 0 and i != j:
					break
				elif j > math.sqrt(i):
					list.append(prime, i)
					break
		return prime
prime = prnum.calprnum(1010)
n = int(input())
arr = str(input()).split()
for i in range(n):
	s = int(arr[i])
	ss = math.sqrt(s)
	if s == 1:
		print('NO')
	elif int(ss) != ss:
		print('NO')
	else:
		ss = int(ss)
		for j in prime:
			if ss % j == 0 and ss != j:
				print('NO')
				break
			elif j > math.sqrt(ss):
				print('YES')
				break


import math
n = int(input())
line = str(input()).split()
line = [int(it) for it in line]
prime = [True] * 1000001
prime[0] = prime[1] = False
for i in range(2, 1000001):
	if prime[i]:
		for j in range(i * i, 1000001, i):
			prime[j] = False
for it in line:
	tar = int(math.sqrt(it))
	if tar * tar == it and prime[tar]:
		print('YES')
	else:
		print('NO')


import heapq as hp
import math

def primeSeive(n):
	l = [True] * (n + 1)
	l[0] = l[1] = False
	l[2] = l[3] = True
	for i in range(4, n + 1, 2):
		l[i] = False
	for i in range(9, n + 1, 3):
		l[i] = False
	for i in range(10, n + 1, 5):
		l[i] = False
	for i in range(7, int(math.sqrt(n)) + 1, 2):
		if l[i]:
			for j in range(i * i, n + 1, i):
				l[j] = False
	return [i for i in range(n + 1) if l[i]]

def unpack(func=int):
	return map(func, input().split())

def range_n():
	return range(int(input()))

def main():
	n = int(input())
	prime = set(primeSeive(10 ** 6 + 1))
	for n in unpack():
		sqrt = math.sqrt(n)
		print('YES' if n != 1 and int(sqrt) == sqrt and (int(sqrt) in prime) else 'NO')
main()


import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def isPrime(n):
	l = int(sqrt(n)) + 1
	if n == 1:
		return False
	if n == 2:
		return True
	for i in range(2, l + 1):
		if n % i == 0:
			return False
	return True

def nod(n):
	root = int(ceil(sqrt(n)))
	foo = int(sqrt(n))
	if root == foo and isPrime(root):
		return 'YES'
	return 'NO'

def main():
	n = inp()
	a = inlist()
	for i in range(n):
		print(nod(a[i]))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


import math
b = int(input())
a = b ** 0.5 + 1
d = [False, False, True] + [True, False] * 500000
for i in range(3, 1000, 2):
	for j in range(i * i, 1000000, i):
		d[j] = False
e = list(map(int, input().split()))
for i in range(b):
	c = e[i] ** 0.5
	if not c % 1:
		if d[int(c)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


l = 1000000

def is_prime():
	p_f = [True] * l
	p_f[0] = p_f[1] = False
	for i in range(2, l):
		if p_f[i] == True:
			for j in range(i * i, l, i):
				p_f[j] = False
	return p_f

def sq_is_prime(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if p_f[int(sqrt_n)] == True:
			return True
	return False
p_f = is_prime()
a = int(input())
in_a = list(map(int, input().split()))
for i in in_a:
	if sq_is_prime(i) == True:
		print('YES')
	else:
		print('NO')


from math import sqrt
m = int(input())
q = [int(i) for i in input().split(' ')]

def main():
	for i in range(m):
		T_Primes(q[i])

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	k = int(sqrt(n)) + 1
	for i in range(5, k, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def T_Primes(n):
	sq = int(sqrt(n))
	if 1 * sq * sq != n:
		print('NO')
	elif isPrime(sq):
		print('YES')
	else:
		print('NO')
main()


l1 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
l = [True] * 1000000
for i in l1:
	for j in range(i ** 2, 1000000, i):
		l[j] = False
n = int(input())
m = list(map(int, input().split()))
for j in range(n):
	s = m[j] ** 0.5
	if s % 1 != 0 or s == 1:
		print('NO')
	elif s % 2 == 0:
		if s != 2:
			print('NO')
		else:
			print('YES')
	elif l[int(s)]:
		print('YES')
	else:
		print('NO')


def sieve(n):
	prime = [True for i in range(n + 1)]
	prime[0] = False
	prime[1] = False
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
_ = input()
l = map(int, input().split())
s = sieve(10 ** 6)
for n in l:
	if n ** 0.5 == int(n ** 0.5):
		print('YES' if s[int(n ** 0.5)] else 'NO')
	else:
		print('NO')


import bisect

def SieveOfEratosthenes(n):
	a = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n):
		if prime[p]:
			a.append(p)
	return a
a = SieveOfEratosthenes(10 ** 6)
n = int(input())
b = [int(i) for i in input().split()]
for i in b:
	if a[bisect.bisect(a, int(i ** 0.5)) - 1] == i ** 0.5:
		print('YES')
	else:
		print('NO')


m = 10 ** 6
IsPrime = [True for i in range(m + 1)]
for x in range(2, m + 1):
	if IsPrime[x]:
		for t in range(x * x, m + 1, x):
			IsPrime[t] = False
IsPrime[1] = False
from math import sqrt
n = int(input())
A = list(map(int, input().split()))
for x in A:
	y = int(sqrt(x))
	if y * y == x and IsPrime[y]:
		print('YES')
	else:
		print('NO')


input()
a = map(int, input().split())
N = 1000002
sieve = [0, 0] + [1] * N
primes = set()
for j in range(2, N):
	if sieve[j]:
		primes.add(j)
		for i in range(j * j, N, j):
			sieve[i] = 0
for v in a:
	r = round(v ** 0.5)
	if r * r == v:
		if r in primes:
			print('YES')
			continue
	print('NO')


import math
nmax = 1000005
c = [0] * nmax

def ciur():
	c[1] = 1
	for i in range(1, nmax):
		if c[i] == 0:
			for j in range(i * i, nmax, i):
				c[j] = 1
n = int(input())
v = input().split(' ')
ciur()
for i in range(n):
	value = int(math.sqrt(int(v[i])))
	if value * value == int(v[i]) and c[value] == 0:
		print('YES')
	else:
		print('NO')


import math

def sieveOfEratosthenes(n, prime):
	p = 2
	while p ** 2 <= n:
		if prime[p] == True:
			for i in range(p ** 2, n, p):
				prime[i] = False
		p += 1
p1 = 10 ** 6 + 10
prime = [True] * p1
sieveOfEratosthenes(p1, prime)
prime[1] = False
n = int(input())
arr = list(map(int, input().split()))
for i in arr:
	sq = int(math.sqrt(i))
	if sq ** 2 != i:
		print('NO')
	elif prime[sq]:
		print('YES')
	else:
		print('NO')


import math
from functools import lru_cache
from sys import stdin
input = stdin.readline
input()
l = [*map(int, input().split())]

@lru_cache(None)
def isPrime(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
for num in l:
	root = int(math.sqrt(num))
	if root ** 2 != num or num <= 2:
		print('NO')
		continue
	if isPrime(root):
		print('YES')
	else:
		print('NO')


def isTPrime(n):
	s = n ** 0.5
	if s != int(s):
		return False
	else:
		return isPrime(int(s))

def isPrime(n):
	if n == 1:
		return False
	elif n <= 3:
		return True
	elif n % 2 == 0 or n % 3 == 0:
		return False
	else:
		for i in range(3, int(n ** 0.5) + 1, 2):
			if n % i == 0:
				return False
	return True
n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	if isTPrime(l[i]):
		print('YES')
	else:
		print('NO')


X = [True for i in range(1000001)]
R = set()
for i in range(2, 1000000):
	if X[i]:
		for j in range(i * i, 1000000, i):
			X[j] = False
		R.add(i * i)
input()
for u in map(int, input().split()):
	if u in R:
		print('YES')
	else:
		print('NO')


import math

def resheto(number):
	a = [True] * number
	for i in range(2, int(math.sqrt(number))):
		for j in range(i * i, number, i):
			a[j] = False
	return [i * i for i in range(2, number) if a[i]]

def codeforces():
	_ = input()
	lst = [int(i) for i in input().split()]
	st = set(resheto(10 ** 6))
	res = ''
	for num in lst:
		if num in st:
			res += 'YES\n'
		else:
			res += 'NO\n'
	print(res)
codeforces()


limit = 1000000

def calculate_prime_flag_for_each_number_upto_limit():
	prime_flag = [True] * limit
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, limit):
		if prime_flag[i] == True:
			for j in range(i * i, limit, i):
				prime_flag[j] = False
	return prime_flag

def check_if_a_number_is_t_prime(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if prime_flag[int(sqrt_n)] == True:
			return True
	return False
prime_flag = calculate_prime_flag_for_each_number_upto_limit()
total_numbers = int(input())
input_array = list(map(int, input().split()))
for i in input_array:
	if check_if_a_number_is_t_prime(i) == True:
		print('YES')
	else:
		print('NO')


from math import sqrt

def main():
	num_ints = int(input())
	nums = list(map(int, input().split()))
	num2output = {}
	for i in range(num_ints):
		if nums[i] in num2output:
			print(num2output[nums[i]])
		else:
			output = 'YES' if is_t_prime(nums[i]) else 'NO'
			print(output)
			num2output[nums[i]] = output

def is_t_prime(n):
	the_sqrt = int(sqrt(n))
	if sqrt(n) - the_sqrt != 0:
		return False
	return is_prime(the_sqrt)

def is_prime(n):
	the_sqrt = int(sqrt(n))
	num_factors = 0
	for divisor in range(1, the_sqrt + 1):
		if n % divisor == 0:
			num_factors += 2 if n // divisor != divisor else 1
	return num_factors == 2
main()


M = [0] * 1000001
bool(M)
m = []
for i in range(0, 1000001):
	M[i] = True
M[0] = M[1] = False
for j in range(2, 1000):
	if M[j]:
		for l in range(2 * j, 1000001, j):
			M[l] = False
n = int(input())
a = list(map(int, input().split(' ')))
for k in range(n):
	b = a[k] ** 0.5
	if b == a[k] // b and M[int(b)]:
		print('YES')
	else:
		print('NO')


t = [0] * 1000005
t[0] = 1
t[1] = 1
for i in range(2, 1000005):
	if t[i] == 0:
		for j in range(i + i, 1000005, i):
			t[j] = 1
input()
a = list(map(int, input().split()))
for i in a:
	print('YES' if i > 1 and i ** 0.5 == int(i ** 0.5) and (t[int(i ** 0.5)] == 0) else 'NO')


n = int(input())
a = list(map(int, input().split()))

def isprime(k):
	if k == 1:
		return False
	if k == 2:
		return True
	for i in range(2, int(k ** 0.5) + 1):
		if k % i == 0:
			return False
	return True
for i in range(n):
	if (a[i] ** 0.5).is_integer() and isprime(int(a[i] ** 0.5)):
		print('YES')
	else:
		print('NO')


import math
mas = [0] * (10 ** 6 + 1)
mas[1] = 1
for i in range(2, 10 ** 3):
	if mas[i] == 0:
		for j in range(i, 10 ** 6 + 1, i):
			if j != i:
				mas[j] = 1
n = input()
for i in input().split(' '):
	a = int(i)
	b = math.sqrt(a)
	if int(b) == b and mas[int(b)] == 0:
		print('YES')
	else:
		print('NO')


from math import *

def isPrime(n):
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
n = int(input())
l = map(int, input().split())
for i in l:
	n = sqrt(i)
	if i == 1:
		print('NO')
	elif ceil(n) == floor(n):
		n = floor(n)
		if isPrime(n):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


while 1:
	try:
		n = int(input())
		a = list(map(int, input().split()))
		s = set()
		b = [1] * 1000001
		for i in range(2, 1000001):
			if b[i]:
				s.add(i * i)
				for j in range(2 * i, 1000001, i):
					b[j] = 0
		for ele in a:
			print('YES') if ele in s else print('NO')
	except EOFError:
		break


sqrt_lim = int((10 ** 12) ** 0.5 + 1)

def prime_squares():
	arr = [False for i in range(sqrt_lim)]
	arr[0] = True
	for i in range(2, int(sqrt_lim ** 0.5)):
		if not arr[i - 1]:
			for j in range(i ** 2, sqrt_lim, i):
				arr[j - 1] = True
	res = set()
	for i in range(2, sqrt_lim):
		if not arr[i - 1]:
			res.add(i ** 2)
	return res
n = int(input())
p = prime_squares()
for x in map(int, input().split()):
	if x in p:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
possiblePrime = int(1000000.0 + 1)
Prime = [2]
p = [0] * possiblePrime
for i in range(3, possiblePrime, 2):
	if p[i]:
		continue
	Prime.append(i)
	for j in range(i * i, possiblePrime, i):
		p[j] = 1
TPrime = set([t ** 2 for t in Prime])
print('\n'.join(('YES' if i in TPrime else 'NO' for i in a)))


import math
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if a[i] == 1:
		print('NO')
	else:
		p = int(math.sqrt(a[i]))
		if p * p != a[i]:
			print('NO')
		else:
			f = 1
			for k in range(2, int(math.sqrt(p)) + 1):
				if p % k == 0:
					f = 0
					break
			if f == 1:
				print('YES')
			else:
				print('NO')


input()
x = [int(s) for s in input().split()]
from math import *
n = 1000000
a = list(range(n + 1))
a[1] = 0
i = 2
while i <= n:
	if a[i] != 0:
		for j in range(i * i, n + 1, i):
			a[j] = 0
	i += 1
for i in x:
	if int(sqrt(i)) == sqrt(i):
		if a[int(sqrt(i))] != 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
arr = [int(x) for x in input().split(' ')]
primes = []
limit = 10 ** 6
is_primes = [True] * (limit + 1)
is_primes[0] = False
is_primes[1] = False
p = 2
while p * p <= limit:
	if is_primes[p]:
		for i in range(p * 2, limit + 1, p):
			is_primes[i] = False
	p += 1
for val in arr:
	x = math.sqrt(val)
	if x == int(x) and is_primes[int(x)]:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
for num in list(map(int, input().split())):
	sqrt = math.sqrt(num)
	if num % sqrt == 0 and num > 1:
		i = 2
		while i * i <= int(sqrt):
			if int(sqrt) % i == 0:
				print('NO')
				break
			else:
				i += 1
		else:
			print('YES')
	else:
		print('NO')


import os
import sys
from collections import defaultdict
from math import sqrt, floor, ceil
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
readint = lambda : int(sys.stdin.readline().rstrip('\r\n'))
readints = lambda : map(int, sys.stdin.readline().rstrip('\r\n').split())
readstr = lambda : sys.stdin.readline().rstrip('\r\n')
readstrs = lambda : map(str, sys.stdin.readline().rstrip('\r\n').split())
readarri = lambda : [int(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
readarrs = lambda : [str(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
N = int(1000000.0)
primes = [1 for _ in range(N)]
primes[0] = primes[1] = 0
p = 2
while p * p <= N:
	if primes[p]:
		for i in range(p * p, N, p):
			primes[i] = 0
	p += 1
dd = defaultdict(int)
for i in range(2, N):
	if primes[i]:
		dd[i] = 1

def solve():
	n = readint()
	arr = readarri()
	for i in arr:
		if floor(sqrt(i)) == ceil(sqrt(i)) and dd[int(sqrt(i))]:
			print('YES')
		else:
			print('NO')

def main():
	t = 1
	for _ in range(t):
		solve()
main()


import math
a = int(input())
b = [int(x) for x in input().split()]
for x in b:
	pos_prime = int(math.sqrt(x))
	if x < 4:
		print('NO')
	elif pos_prime * pos_prime == x:
		for y in range(2, int(math.sqrt(pos_prime)) + 1):
			if pos_prime % y == 0:
				print('NO')
				break
		else:
			print('YES')
	else:
		print('NO')


n = int(input())
s = list(map(int, input().split()))
m = max(s)
mm = int(m ** 0.5) + 1
q = [True] * (mm + 1)
q[1] = False
for y in range(4, mm + 1, 2):
	q[y] = False
for x in range(3, mm + 1, 2):
	for b in range(3, int(x ** 0.5) + 1):
		if x % b == 0:
			q[x] = False
			break
for z in range(n):
	zz = s[z] ** 0.5
	if int(zz) == zz:
		if q[int(zz)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def sieve():
	p = []
	isprime = [1 for i in range(10 ** 6 + 1)]
	for i in range(2, 10 ** 3 + 1):
		if isprime[i]:
			for j in range(i * i, 10 ** 6 + 1, i):
				isprime[j] = 0
	for i in range(2, 10 ** 6 + 1):
		if isprime[i]:
			p.append(i * i)
	return set(p)
n = int(input())
a = [int(x) for x in input().split()]
p = sieve()
for i in a:
	if i in p:
		print('YES')
	else:
		print('NO')


import math

def verifica_primo(x):
	if x < 4:
		return False
	if x == 4:
		return True
	if x % 2 == 0:
		return False
	raiz = math.sqrt(x)
	if float(raiz).is_integer():
		if tabela[int(raiz)] == True:
			return True
	return False

def pre_calculo():
	tabela = [True] * 1000000
	tabela[0] = False
	tabela[1] = False
	for i in range(2, 1000000):
		if tabela[i] == True:
			for j in range(i * i, 1000000, i):
				tabela[j] = False
	return tabela
tabela = pre_calculo()
n = int(input())
vetor = list(map(int, input().split()))
for i in vetor:
	if verifica_primo(i) == True:
		print('YES')
	else:
		print('NO')


import sys
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
import bisect
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def sieve(N):
	Nroot = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, Nroot + 1):
		if primes[i] == 1:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	n = iinp()
	arr = intl()
	primes = sieve(int(1000000.0) + 5)
	for i in arr:
		if int(sqrt(i)) == sqrt(i) and primes[int(sqrt(i))] == 1:
			print('YES')
		else:
			print('NO')
solve()


def isprime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, int(n ** 0.5) + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True
n = int(input())
arr = [int(i) for i in input().split()]
for i in arr:
	a = int(i ** 0.5)
	if not a * a == i:
		print('NO')
	elif isprime(a):
		print('YES')
	else:
		print('NO')


from math import sqrt
n = int(sqrt(1000000000000))
li = [0] * (n + 10)
s = set()
for i in range(2, int(sqrt(n + 10))):
	if li[i] == 0:
		for j in range(i * 2, n + 10, i):
			li[j] = 1
for i in range(2, n + 10):
	if li[i] == 0:
		s.add(i * i)
input()
lis1 = list(map(int, input().split()))
for a in lis1:
	if a in s:
		print('YES')
	else:
		print('NO')


input()
n = 1000001
c = [True] * n
d = set()
for i in range(2, n):
	if c[i]:
		d.add(str(i * i))
		for y in range(i * i, n, i):
			c[y] = False
for i in input().split(' '):
	if i in d:
		print('YES')
	else:
		print('NO')


limit = 10 ** 6
A = [0 for i in range(limit + 1)]
A[0] = 1
A[1] = 1
A[limit] = 1
primes = []
for i in range(3, limit + 1, 2):
	if A[i] == 0:
		primes.append(i)
		for j in range(2 * i, i * int(limit / i) + 1, i):
			A[j] = 1
ans = set(list(map(lambda x: str(x ** 2), primes)))
ans.add(str(4))
x = input()
a = input()
N = a.split(' ')
for n in range(int(x)):
	if N[n] in ans:
		print('YES')
	else:
		print('NO')


import math

def sieve(n):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
prime = [True for i in range(1000000 + 5)]
n = 10 ** 6
sieve(n)
prime[1] = False
k = int(input())
lis = list(map(int, input().split()))
for i in lis:
	aa = math.sqrt(i)
	if aa * 10000 == int(aa) * 10000:
		if prime[int(aa)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
n = 1000000
isprime = [True] * (n + 1)
isprime[1] = False
for i in range(2, n):
	if isprime[i]:
		for j in list(range(i + i, n + 1, i)):
			isprime[j] = False
for i in l:
	r = i ** 0.5
	if r == int(r) and isprime[int(r)]:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
arr = input().split()
sang = []
Max = int(1000000.0) + 1
for i in range(Max + 1):
	sang.append(True)
sang[0] = sang[1] = False
j = 2
while j * j <= Max:
	if sang[j]:
		k = j * j
		while k <= Max:
			sang[k] = False
			k += j
	j += 1
for i in range(len(arr)):
	arr[i] = int(arr[i])
	temp = int(math.sqrt(arr[i]))
	if temp * temp == arr[i] and arr[i] != 1 and sang[temp]:
		print('YES')
	else:
		print('NO')


n = int(input())
l = [int(i) for i in input().split()]
a = max(l)
a = int(a ** 0.5)
p = [True] * (a + 1)
for i in range(2, int(a ** 0.5 + 1)):
	if p[i]:
		for t in range(i * 2, a + 1, i):
			p[t] = False
for i in l:
	if i ** 0.5 - int(i ** 0.5) != 0:
		print('NO')
		continue
	i = int(i ** 0.5)
	if p[i] and i != 1:
		print('YES')
	else:
		print('NO')


from math import sqrt

def is_prime(foo):
	if foo % 3 == 0 or foo % 2 == 0 or foo < 1:
		if foo == 3 or foo == 2:
			return True
		else:
			return False
	bar = int(sqrt(foo))
	for i in range(5, bar + 1, 2):
		if foo % i == 0:
			return False
	return True

def is_t(bar):
	if bar == 1:
		return False
	foo = bar ** 0.5
	if foo != int(foo):
		return False
	return is_prime(int(foo))
n = int(input())
x = list(map(int, input().split()))
for xi in x:
	if is_t(xi):
		print('YES')
	else:
		print('NO')


def tprimes(n):
	p = [i & 1 for i in range(n + 1)]
	(p[0], p[1], p[2]) = (False, False, True)
	i = 3
	tp = [4]
	while i <= n:
		if p[i]:
			j = i * i
			tp.append(j)
			while j <= n:
				p[j] = False
				j += i
		i += 2
	return tp
tp = set(tprimes(int(1000000.0)))
n = int(input())
for i in map(int, input().split()):
	print(['NO', 'YES'][i in tp])


input()
n = 10 ** 6 + 1
arr = [1] * n
tprimeSet = set()
for i in range(2, n):
	if arr[i] == 1:
		tprimeSet.add(i ** 2)
		for j in range(i, n, i):
			arr[j] = 0
for i in list(map(int, input().split())):
	if i in tprimeSet:
		print('YES')
	else:
		print('NO')


import math

def numerosPrimos(N):
	numbers = [True, True] + [True] * (N - 1)
	last_prime_number = 2
	i = last_prime_number
	while last_prime_number ** 2 <= N:
		i += last_prime_number
		while i <= N:
			numbers[i] = False
			i += last_prime_number
		j = last_prime_number + 1
		while j < N:
			if numbers[j]:
				last_prime_number = j
				break
			j += 1
		i = last_prime_number
	return [i + 2 for (i, not_crossed) in enumerate(numbers[2:]) if not_crossed]
N = numerosPrimos(1000000)
from bisect import bisect_left

def bi_contains(lst, item):
	return item <= lst[-1] and lst[bisect_left(lst, item)] == item
n = input()
n = int(n)
A = []
S = []
A = map(int, input().split(' '))
for i in A:
	if i < 4:
		S.append('NO')
	elif i == 4:
		S.append('YES')
	else:
		r = math.sqrt(i)
		V = r == r // 1
		P = bi_contains(N, int(r))
		if V and P:
			S.append('YES')
		else:
			S.append('NO')
for i in S:
	print(i)


from math import sqrt
a = [True] * (10 ** 6 + 1)
b = {}
r = 10 ** 6 // 2 + 1
for i in range(2, r):
	if a[i] == False:
		continue
	for j in range(2 * i, 10 ** 6 + 1, i):
		a[j] = False
for i in range(2, 10 ** 6 + 1):
	if a[i] == True:
		b[i * i] = True
n = int(input())
a = list(map(int, input().split()))
for i in a:
	if i in b:
		print('YES')
	else:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
ans = []
for i in l:
	pm = int(i ** (1 / 2))
	if pm * pm == i and i != 1:
		ksq = int(pm ** (1 / 2)) + 1
		while ksq > 1:
			if pm % ksq == 0:
				break
			ksq -= 1
		if ksq == 1 or pm == 2:
			ans.append('YES')
		else:
			ans.append('NO')
	else:
		ans.append('NO')
	print(ans[-1])


from sys import stdin, stdout
from math import sqrt
inp = stdin.readline
out = stdout.write
n = int(inp().strip())
primes = [0] * int(1000000.0)
s = set()
for i in range(2, int(1000000.0)):
	if not primes[i]:
		s.add(i * i)
		primes[i * i::i] = [1] * len(primes[i * i::i])
for i in map(int, inp().strip().split()):
	print('YES' if i in s else 'NO')


def seive():
	l = [1 for i in range(10 ** 6 + 1)]
	l[0] = 0
	l[1] = 0
	for i in range(2, 10 ** 6 + 1):
		if l[i] == 1:
			for j in range(i * i, 10 ** 6 + 1, i):
				l[j] = 0
	prime = set()
	prime.add(2)
	for i in range(3, 10 ** 6 + 1, 2):
		if l[i]:
			prime.add(i)
	return prime
prime = seive()
n = int(input())
l = list(map(int, input().split()))
for i in l:
	if i ** 0.5 in prime:
		print('YES')
	else:
		print('NO')


def get_prime(upper):
	upper += 1
	p = [0] * upper
	primes = [2]
	for i in range(3, upper, 2):
		if p[i]:
			continue
		primes.append(i)
		for j in range(i * 2, upper, i):
			p[j] = 1
	return primes

def main():
	t = set([p * p for p in get_prime(int(1000000.0))])
	_ = input()
	nums = list(map(int, input().split()))
	print('\n'.join(('YES' if i in t else 'NO' for i in nums)))
main()


from collections import *
from bisect import *
from math import *
from heapq import *
from fractions import *
import sys
input = sys.stdin.readline
t = 1

def r(a):
	return a * (a - 1) // 2
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	for i in a:
		c = pow(i, 0.5)
		if c * c != i or ceil(c) != floor(c):
			print('NO')
			continue
		c = int(c)
		if c % 2 == 0 and c != 2 or c == 1:
			print('NO')
			continue
		s = 0
		for j in range(3, int(pow(c, 0.5)) + 1, 2):
			if c % j == 0:
				s = 1
				break
		if not s:
			print('YES')
		else:
			print('NO')


from math import sqrt
primes = [True for i in range(1000001)]
primes[1] = False

def SieveOfEratosthenes(n):
	p = 2
	while p * p <= n:
		if primes[p] == True:
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1

def isThreeDisctFactors(n):
	sq = int(sqrt(n))
	if 1 * sq * sq != n:
		return False
	if primes[sq] == True:
		return True
	else:
		return False
t = int(input())
nums = list(map(int, input().split()))
SieveOfEratosthenes(1000000)
for i in nums:
	if isThreeDisctFactors(i):
		print('YES')
	else:
		print('NO')


import math

def t_primo(num, tabela_primos):
	raiz = int(math.sqrt(num))
	if raiz * raiz == num and tabela_primos[raiz] == True:
		return 'YES'
	return 'NO'

def encontra_primos():
	maximo = 1000001
	tabela_primos = [True] * maximo
	tabela_primos[1] = False
	for i in range(2, maximo):
		if tabela_primos[i] == True:
			j = i * i
			if j > maximo:
				break
			while j < maximo:
				tabela_primos[j] = False
				j += i
	return tabela_primos
tabela_primos = encontra_primos()
input()
numeros = input().split()
for valor in numeros:
	print(t_primo(int(valor), tabela_primos))


import math
N = int(input())
X = list(map(int, input().split()))
primes = set([])
M = 1100000
is_primes = [True for _ in range(M)]
is_primes[0] = False
is_primes[1] = False
for i in range(1, math.ceil(math.sqrt(M))):
	if is_primes[i]:
		for j in range(i + i, M, i):
			is_primes[j] = False
for x in X:
	x_sqrt = math.sqrt(x)
	if x_sqrt != int(x_sqrt):
		print('NO')
	elif is_primes[int(x_sqrt)]:
		print('YES')
	else:
		print('NO')


import math

def seive(n):
	b = [i for i in range(n + 1)]
	i = 2
	while i < len(b):
		if b[i] == 0:
			i += 1
		else:
			k = 2
			j = i * k
			while j < len(b):
				b[j] = 0
				k += 1
				j = i * k
			i += 1
	return b
n = int(input())
a = list(map(int, input().split(' ')))
import math
for i in range(len(a)):
	a[i] = [a[i], i]

def myfun(v):
	return v[0]
a.sort(key=myfun)
for i in range(n):
	a[i][0] = math.sqrt(a[i][0])
b = seive(int(a[-1][0]))[2:]
i = 0
j = 0
c = [i for i in range(n)]
while i < len(b) and j < n:
	if b[i] == a[j][0]:
		c[a[j][1]] = 'YES'
		j += 1
	elif b[i] < a[j][0]:
		i += 1
	else:
		c[a[j][1]] = 'NO'
		j += 1
for k in range(j, n):
	c[a[k][1]] = 'NO'
for o in c:
	print(o)


def isprime(n):
	prime = [1 for i in range(n + 1)]
	prime[1] = 0
	p = 2
	while p <= n ** 0.5:
		if prime[p] == 1:
			for i in range(p * p, n + 1, p):
				prime[i] = 0
		p += 1
	return prime
n = int(input())
k = list(map(int, input().split()))
p = isprime(1000000)
for i in range(n):
	x = k[i] ** 0.5
	if x == int(x):
		if p[int(x)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math

def isPrime(n):
	if n <= 1:
		return False
	isprime = True
	i = 2
	while i * i <= n:
		if n % i == 0:
			isprime = False
			break
		i = i + 1
	return isprime
n = int(input())
x = list(map(int, input().split()))
for i in range(n):
	z = round(math.sqrt(x[i]))
	if z * z == x[i] and isPrime(z):
		print('YES')
	else:
		print('NO')


from math import sqrt

def primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]
A = set(primes(10 ** 6))
N = int(input())
S = list(map(int, input().split()))
for x in S:
	B = sqrt(x)
	if B % 1 == 0 and int(B) in A:
		print('YES')
	else:
		print('NO')


n = int(input())
x = list(map(int, input().split()))
tprimes = set()
bound = 1000000
is_prime = [False, False] + [True] * bound
for p in range(2, bound + 1):
	if is_prime[p]:
		tprimes.add(p ** 2)
		for i in range(p, bound + 1, p):
			is_prime[i] = False
for i in range(n):
	if x[i] in tprimes:
		print('YES')
	else:
		print('NO')


nums = [1, 1] + [0] * 10 ** 6
for i in range(2, 1000002):
	if not nums[i]:
		for j in range(i * i, 1000002, i):
			nums[j] = 1
n = int(input())
for i in map(int, input().split()):
	x = int(i ** 0.5)
	if not nums[x] and x * x == i:
		print('YES')
	else:
		print('NO')


input()
arr = [1] * int(1000000.0 + 1)
tprimes = set()
for i in range(2, int(1000000.0 + 1)):
	if arr[i]:
		tprimes.add(i * i)
		for j in range(2 * i, int(1000000.0 + 1), i):
			arr[j] = 0
[print(('NO', 'YES')[i in tprimes]) for i in map(int, input().split())]


import math

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def isPrime(n):
	if n != int(n):
		return False
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	else:
		return True
n = int(input())
arr = list(map(int, input().split()))
prime = SieveOfEratosthenes(int(max(arr) ** 0.5) + 1)
prime[1] = False
for i in arr:
	sqroot = math.sqrt(i)
	if sqroot != int(sqroot):
		print('NO')
		continue
	elif prime[int(sqroot)]:
		print('YES')
	else:
		print('NO')


import math
l = [1] * (10 ** 6 + 1)
l[0] = 0
l[1] = 0
k = 2
while k * k <= 10 ** 6:
	if l[k] == 1:
		for i in range(k * 2, 10 ** 6 + 1, k):
			l[i] = 0
	k += 1

def SieveOfEratosthenes(n):
	if l[n] == 1:
		return 0
	else:
		return 1
m = int(input())
a = list(map(int, input().split()))
for x in a:
	if math.sqrt(x) != int(math.sqrt(x)):
		print('NO')
	else:
		print(['YES', 'NO'][SieveOfEratosthenes(int(math.sqrt(x)))])


input()
s = [1] * 1000001
s[1] = 0
p = 2
while p < 1000000:
	for i in range(2 * p, 1000001, p):
		s[i] = 0
	while p < 1000000:
		p += 1
		if s[p] == 1:
			break

def f(x):
	return 'YES' if int(x) ** 0.5 % 1 == 0 and s[int(int(x) ** 0.5)] == 1 else 'NO'
for i in input().split():
	print(f(i))


primes = [True] * 1000000
primes[1] = primes[0] = False
for j in range(2, 1000000):
	if primes[j] == True:
		for k in range(j * j, 1000000, j):
			primes[k] = False
tests = int(input())
num_array = [int(i) for i in input().split()]
for j in num_array:
	if j == 4:
		print('YES')
		continue
	if j < 4 or j % 2 == 0:
		print('NO')
		continue
	sqr = j ** 0.5
	if int(sqr) == sqr:
		if primes[int(sqr)] == True:
			print('YES')
			continue
	print('NO')
	continue


def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
t = int(input())
l = list(map(int, input().split()))
for z in range(t):
	n = l[z]
	t = int(n ** 0.5)
	if t ** 2 == n:
		if isPrime(t):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
limit = 1000000
prime = [1] * (limit + 1)
prime[0] = 0
prime[1] = 0
for i in range(2, limit + 1):
	if prime[i] == 1:
		for j in range(i * i, limit + 1, i):
			prime[j] = 0
a = [int(x) for x in input().split()]

def check(d: int):
	sq = d ** 0.5
	if int(sq) != sq:
		return False
	if prime[int(sq)] == 0:
		return False
	return True
for i in a:
	if i == 1:
		print('NO')
	else:
		rs = 'YES' if check(i) else 'NO'
		print(rs)


def isPerfectSquare(value):
	return value == int(value ** 0.5) * int(value ** 0.5)
N = 10 ** 6 + 10
primes = [0 for i in range(N)]
primes[0] = 1
primes[1] = 1
for i in range(2, N):
	if not primes[i]:
		for j in range(i + i, N, i):
			primes[j] = 1
n = int(input())
x = list(map(int, input().split()))
for i in x:
	if primes[int(i ** 0.5)] or not isPerfectSquare(i):
		print('NO')
	else:
		print('YES')


def eratosthenes(n):
	sieve = list(range(n + 1))
	sieve[1] = 0
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sieve
n = int(input())
k = eratosthenes(10 ** 6)
l = list(map(int, input().split()))
for i in range(n):
	if l[i] ** (1 / 2) == int(l[i] ** (1 / 2)):
		if k[int(l[i] ** (1 / 2))] != 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
cycle = int(input())
l = list(map(lambda x: math.sqrt(int(x)), input().split()))
for time in range(cycle):
	m = l[time]
	if m == int(m) and m != 1:
		m = int(m)
		for x in range(2, math.floor(math.sqrt(m)) + 1):
			if m % x == 0:
				print('NO')
				break
		else:
			print('YES')
	else:
		print('NO')


import sys

def main():
	n = 2 ** 20
	flags_array = [1] * n
	squre = {4}
	_len = int(input())
	a = list(map(int, input().split()))
	for i in range(2, n):
		if flags_array[i]:
			for j in range(i * i, n, i):
				flags_array[j] = 0
			squre.add(i * i)
	for i in range(_len):
		if a[i] in squre:
			print('YES')
		else:
			print('NO')
	return
sys.exit(main())


prime = [True] * (10 ** 6 + 1)
for p in range(2, 10 ** 3):
	if prime[p]:
		for i in range(p * 2, 10 ** 6 + 1, p):
			prime[i] = False
input()
prime[0] = prime[1] = False
for c in list((int(i) ** 0.5 for i in input().split())):
	print('YNEOS'[int(c) != c or not prime[int(c)]::2])


su = [True for i in range(1000000)]
r = set()
for i in range(2, 1000000):
	if su[i]:
		for j in range(i * i, 1000000, i):
			su[j] = False
		r.add(i * i)
input()
C = list(map(int, input().split()))
for i in C:
	print('YES' if i in r else 'NO')


import math

def tprime(k):
	z = math.sqrt(k)
	if math.floor(z) == math.ceil(z):
		if prima[math.floor(z)]:
			return True
		else:
			return False
	else:
		return False
n = int(input())
z = list(map(int, input().split()))
prima = [True] * 1000001
prima[0] = False
prima[1] = False
for i in range(2, 10 ** 6):
	if prima[i]:
		for j in range(i ** 2, 1000001, i):
			prima[j] = False
for i in range(n):
	if tprime(z[i]):
		print('YES')
	else:
		print('NO')


bs = ['1'] * (10 ** 6 + 5)
from math import *

def seive(n):
	global bs
	bs[0] = '0'
	bs[1] = '0'
	for i in range(0, n):
		if bs[i] == '1':
			for j in range(i * i, n, i):
				bs[j] = '0'
seive(1000000 + 2)
n = int(input())
l = list(map(int, input().split()))
for i in l:
	h = int(sqrt(i))
	if h * h == i and bs[h] == '1':
		print('YES')
	else:
		print('NO')


import math as m
n1 = int(1000000.0)
prime = [True for i in range(n1 + 1)]
prime[0] = False
prime[1] = False
p = 2
while p * p <= n1:
	if prime[p] == True:
		for i in range(p * p, n1 + 1, p):
			prime[i] = False
	p += 1
prime = [i * i for i in range(n1 + 1) if prime[i] == True]

def search(a, t):
	(l, r) = (0, len(a) - 1)
	while l <= r:
		mid = l + (r - l) // 2
		if a[mid] == t:
			return 1
		elif a[mid] < t:
			l = mid + 1
		else:
			r = mid - 1
	else:
		return -1
n = int(input())
a = list(map(int, input().split()))
for i in a:
	if search(prime, i) == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
li = list(map(int, input().split()))
k = int(max(li) ** 0.5) + 1
pr = [True] * k
for i in range(2, k):
	if pr[i]:
		for j in range(i ** 2, k, i):
			pr[j] = False
for x in li:
	print('YES' if x ** 0.5 == int(x ** 0.5) and x != 1 and pr[int(x ** 0.5)] else 'NO')


input()
limit = int(1000000.0 + 2)
l = [0, 0] + [1] * limit
for i in range(2, limit):
	if l[i]:
		for j in range(i * i, limit, i):
			l[j] = 0
for i in map(int, input().split()):
	t = int(i ** 0.5)
	print(['NO', 'YES'][l[t] == 1 and t * t == i])


n = 1000000
a = [1] * n
s = set()
for i in range(2, n):
	if a[i]:
		s.add(i * i)
		for j in range(i * i, n, i):
			a[j] = 0
input()
for x in map(int, input().split()):
	print(['NO', 'YES'][x in s])


p = [1] * 1000001
p[0] = p[1] = 0
for q in range(2, int(1000001 ** 0.5) + 1):
	if p[q]:
		for w in range(q * q, 1000001, q):
			p[w] = 0
n = int(input())
l = list(map(int, input().split()))
for q in range(n):
	j = int(l[q] ** 0.5)
	if j * j == l[q] and p[j]:
		print('YES')
	else:
		print('NO')


from math import sqrt
n = int(input())
x = list(map(int, input().split()))
check_prime = [1] * 1000001
check_prime[0] = check_prime[1] = 0
for i in range(2, int(sqrt(1000000) + 1)):
	if check_prime[i]:
		for j in range(i * i, 1000001, i):
			check_prime[j] = 0
for i in x:
	if sqrt(i) == int(sqrt(i)):
		if check_prime[int(sqrt(i))]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def Sieve(n):
	prime = [True for i in range(n + 1)]
	prime[0] = False
	prime[1] = False
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
A = Sieve(10 ** 6 + 1)
n = input()
num = [int(x) for x in input().split()]
for i in num:
	if i ** 0.5 == int(i ** 0.5) and A[int(i ** 0.5)]:
		print('YES')
	else:
		print('NO')


import math
p = 10 ** 6 + 2

def Sieve():
	l = [True] * p
	i = 2
	while i * i <= p:
		if l[i]:
			for j in range(2 * i, p, i):
				l[j] = False
		i += 1
	l[0] = l[1] = False
	return l
isprime = Sieve()

def ps(n):
	return int(math.sqrt(n)) == math.sqrt(n)
n = int(input())
l = [int(i) for i in input().split()]
for i in l:
	if ps(i) and isprime[int(math.sqrt(i))]:
		print('YES')
	else:
		print('NO')


from math import sqrt

def get_prime_list(n):
	n = int(n)
	prime_list = []
	prime_mark = [False, False] + [True for _ in range(n - 1)]
	for base in range(2, n + 1):
		if prime_mark[base]:
			prime_list.append(base)
		for prime in prime_list:
			composite = prime * base
			if composite > n:
				break
			prime_mark[composite] = False
	return prime_mark
input()
numbers = input().split()
primes = get_prime_list(10 ** 6)
ans = []
for x in numbers:
	x = int(x)
	sq = int(sqrt(x))
	if x == sq ** 2 and primes[sq]:
		ans.append('YES')
	else:
		ans.append('NO')
print('\n'.join(ans))


n = 10 ** 6 + 1
a = [True] * n
t_primes = {4}
for i in range(2, n):
	if a[i]:
		for j in range(i * i, n, i):
			a[j] = False
		t_primes.add(i * i)
input()
for xi in map(int, input().split()):
	if xi in t_primes:
		print('YES')
	else:
		print('NO')


n = int(input())
alnumber = list(map(int, input().split()))
mmax = max(alnumber)
halfmmax = int(mmax ** (1 / 2)) + 1
alist = [True] * halfmmax
i = 2
while i * 2 < halfmmax:
	if alist[i]:
		for p in range(2 * i, halfmmax, i):
			alist[p] = False
	i += 1
for u in alnumber:
	halfnumber = u ** (1 / 2)
	if halfnumber != int(halfnumber) or u == 1:
		print('NO')
	elif alist[int(halfnumber)]:
		print('YES')
	else:
		print('NO')


n = int(input())
res = [int(i) for i in input().split()]
k = int(max(res) ** (1 / 2)) + 1
L = [True] * k
L[0] = False
for i in range(1, k):
	if L[i]:
		if (i + 1) ** 2 - 1 < k:
			for j in range((i + 1) * (i + 1) - 1, k, i + 1):
				L[j] = False
for t in res:
	if t ** 0.5 % 1 != 0:
		print('NO')
	elif t == 4:
		print('YES')
	elif L[int(t ** (1 / 2)) - 1]:
		print('YES')
	else:
		print('NO')


import random, math
from copy import deepcopy as dc

def randomNumber(s, e):
	return random.randint(s, e)

def randomArray(s, e, s_size, e_size):
	size = random.randint(s_size, e_size)
	arr = [randomNumber(s, e) for i in range(size)]
	return arr

def testcase():
	pass

def brute():
	pass

def effe():
	pass
MAXN = 10 ** 6 + 1
primes = [1] * MAXN
primes[0] = 0
primes[1] = 0

def seive():
	i = 2
	while i * i <= MAXN:
		if primes[i]:
			for j in range(i * i, MAXN, i):
				primes[j] = 0
		i += 1

def solution(num):
	if num == 1:
		return 'NO'
	sq = int(num ** 0.5)
	if sq * sq == num and primes[sq]:
		return 'YES'
	return 'NO'

def input_test():
	n = int(input())
	li = list(map(int, input().strip().split(' ')))
	for i in li:
		out = solution(i)
		print(out)

def test():
	pass
seive()
input_test()


import sys
import math
n = int(sys.stdin.readline())
x = [int(x) for x in sys.stdin.readline().split()]
n = 1000001
simple = [True] * n
simple[0] = False
simple[1] = True
simple[2] = False
prime = [True] * n
result = [2]
append = result.append
sqrt_n = int(n ** 0.5) + 1 | 1
for p in range(3, sqrt_n, 2):
	if prime[p]:
		simple[p] = False
		prime[p * p::2 * p] = [False] * ((n - p * p - 1) // (2 * p) + 1)
for p in range(sqrt_n, n, 2):
	if prime[p]:
		simple[p] = False
for c in x:
	t = math.sqrt(c)
	if t - int(t) == 0:
		if simple[int(t)] == False:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
nums = list(map(int, input().split(' ')))
max_num = max(nums)
m = int(math.sqrt(max_num)) + 1
prime = [True for i in range(m)]
p = 2
while p * p <= m:
	if prime[p] == True:
		for i in range(p * 2, m, p):
			prime[i] = False
	p += 1
prime[0] = False
prime[1] = False
for num in nums:
	sq_rt = math.sqrt(num)
	if sq_rt.is_integer():
		if prime[int(sq_rt)] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
get_int = lambda : map(int, input().split())
prime_supr = 1000001
is_prime = [True for x in range(prime_supr + 1)]
is_prime[0] = is_prime[1] = False
for i in range(2, prime_supr + 1):
	if is_prime[i]:
		for j in range(i + i, prime_supr + 1, i):
			is_prime[j] = False
n = int(input())
a = get_int()
for i in a:
	if i % 2 != 0 and math.sqrt(i) == int(math.sqrt(i)) and is_prime[int(math.sqrt(i))] and (i != 1) or i == 4:
		print('YES')
	else:
		print('NO')


import math
primes = [1] * 1000001
for i in range(2, 1000001):
	if primes[i]:
		for j in range(i + i, 1000001, i):
			primes[j] = 0
primes[1] = 0
n = int(input())
for x in input().split():
	temp = math.sqrt(int(x))
	if temp % 1 == 0 and primes[int(temp)]:
		print('YES')
	else:
		print('NO')


from math import sqrt
n = 1000000
a = list(range(n + 1))
a[1] = 0
lst = []
i = 2
while i <= n:
	if a[i] != 0:
		for j in range(i * i, n + 1, i):
			a[j] = 0
	i += 1
input()
nums = [int(x) for x in input().split()]
for n in nums:
	if n > 10 and n % 2 == 0:
		print('NO')
		continue
	r = sqrt(n)
	if r - int(r) == 0:
		if a[int(r)] != 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def main():
	nmb = 1000000
	a = [True] * (nmb + 1)
	b = {4}
	for i in range(2, nmb):
		if a[i]:
			for j in range(i * i, nmb, i):
				a[j] = False
			b.add(i ** 2)
	input()
	for el in map(int, input().split()):
		print(['NO', 'YES'][el in b])
main()


n = int(input())
l = [int(x) for x in input().split()]
bb = 10 ** 6
s = [True] * (bb + 1)
import math

def sieve(b, ls):
	p = 2
	while p * p <= b:
		if ls[p] == True:
			for i in range(p * 2, b + 1, p):
				ls[i] = False
		p += 1
	return ls
s = sieve(bb, s)
for i in range(n):
	x = l[i]
	y = math.sqrt(x)
	if x < 4:
		print('NO')
	elif int(y) != y:
		print('NO')
	elif s[int(y)]:
		print('YES')
	else:
		print('NO')


n = int(1000000.0)
a = [1] * n
a[0] = a[1] = 0
l = set()
for i in range(n):
	if a[i]:
		l.add(i ** 2)
		for j in range(i * 2, n, i):
			a[j] = 0
m = input()
n = list(map(int, input().split()))
for i in n:
	print('YES' if i in l else 'NO')


import atexit
import io
import sys
from bisect import *
from collections import *
from fractions import gcd
from itertools import *
from math import *
import os
inf = float('inf')
inf_neg = float('-inf')
range_6 = int(10000000.0 + 1)
range_7 = int(1000000.0 + 1)
range_8 = int(100000000.0 + 1)
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def rwh_primes_jason(n):
	zero = bytearray([False])
	size = n // 3 + (n % 6 == 2)
	sieve = bytearray([True]) * size
	sieve[0] = False
	for i in range(int(n ** 0.5) // 3 + 1):
		if sieve[i]:
			k = 3 * i + 1 | 1
			start = (k * k + 4 * k - 2 * k * (i & 1)) // 3
			sieve[k * k // 3::2 * k] = zero * ((size - k * k // 3 - 1) // (2 * k) + 1)
			sieve[start::2 * k] = zero * ((size - start - 1) // (2 * k) + 1)
	ans = [2, 3]
	poss = chain.from_iterable(zip_longest(*[range(i, n, 6) for i in (1, 5)]))
	ans.extend(compress(poss, sieve))
	return ans

def main():
	primes = rwh_primes_jason(range_7)
	primes_sq = set()
	for i in primes:
		primes_sq.add(i * i)
	n = int(input())
	arr = list(map(int, input().split()))
	for j in arr:
		if j in primes_sq:
			print('{}'.format('YES'))
		else:
			print('{}'.format('NO'))
main()


input()
n = 1000000
lst = [True] * (n + 2)
lst[1] = False
for i in range(2, n):
	if lst[i] == True:
		for j in range(2 * i, n + 1, i):
			lst[j] = False
for (i, x) in enumerate(list(map(int, input().split()))):
	y = int(x ** 0.5)
	if y * y == x:
		if lst[y]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def seive():
	l = [1 for i in range(10 ** 6 + 1)]
	l[0] = 0
	l[1] = 0
	for i in range(2, 10 ** 6 + 1):
		if l[i] == 1:
			for j in range(i * i, 10 ** 6 + 1, i):
				l[j] = 0
	prime = set()
	prime.add(2)
	for i in range(3, 10 ** 6 + 1, 2):
		if l[i]:
			prime.add(i)
	return prime
primes = seive()
n = int(input())
arr = [int(i) for i in input().split()]
for i in arr:
	temp = i ** 0.5
	if temp == int(temp):
		if temp in primes:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = 1000005
prime = [True for i in range(n + 5)]
d = {}
p = 2
while p * p <= n:
	if prime[p]:
		for i in range(p * p, n + 1, p):
			prime[i] = False
	p += 1
for p in range(2, n):
	if prime[p]:
		d[p * p] = 1
nm = int(input())
l = list(map(int, input().split()))
for t in l:
	print('YES' if t in d else 'NO')


def SOE(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
ref = SOE(1000000)
ref2 = set()
for i in range(2, 1000001):
	if ref[i]:
		ref2.add(i ** 2)
n = int(input())
lis = [int(x) for x in input().split()]
for item in lis:
	if item in ref2:
		print('YES')
	else:
		print('NO')


m = 10 ** 6
prime = [True] * (m + 1)
p = 2
while p * p <= m:
	if prime[p] == True:
		for i in range(p * p, m + 1, p):
			prime[i] = False
	p += 1
t = int(input())
nums = list(map(int, input().split()))
for c in range(0, t):
	n = nums[c]
	sq = int(n ** 0.5)
	print('YES' if sq * sq == n and n > 3 and (prime[sq] == True) else 'NO')


OK = [0] * 1000005
OK[0] = 1
OK[1] = 1
for i in range(2, 1000005):
	if OK[i] == 0:
		for j in range(i + i, 1000005, i):
			OK[j] = 1
input()
arr = list(map(int, input().split()))
for i in arr:
	print('YES' if i > 1 and i ** 0.5 == int(i ** 0.5) and (OK[int(i ** 0.5)] == 0) else 'NO')


n = int(input())
l = [int(i) for i in input().split()]
p = [0, 0, 1] + [1 for i in range(3, 1000001)]
for i in range(2, 1001):
	if p[i]:
		for i in range(i ** 2, 1000001, i):
			p[i] = 0
for i in l:
	kor = int(i ** 0.5)
	if kor ** 2 == i and p[kor]:
		print('YES')
	else:
		print('NO')


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt, gcd, factorial

def binNumber(n, size=1):
	return bin(n)[2:].zfill(size)

def iar():
	return list(map(int, input().split()))

def ini():
	return int(input())

def isp():
	return map(int, input().split())

def sti():
	return str(input())

def checkprime(a):
	if a == 2 or a == 3:
		return True
	for i in range(2, int(ceil(sqrt(a))) + 1):
		if a % i == 0:
			return False
	return True
n = ini()
a = iar()
for i in a:
	if i == 1 or i == 2 or i == 3:
		print('NO')
		continue
	b = sqrt(i)
	c = int(b)
	if c == b:
		if checkprime(c):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
arr = list(map(int, input().strip().split()))
prime = [True for i in range(1000000 + 1)]
p = 2
while p * p <= 1000000:
	if prime[p] == True:
		for i in range(p * p, 1000000 + 1, p):
			prime[i] = False
	p += 1

def isPerfectSquare(n):
	if math.ceil(math.sqrt(n)) == math.floor(math.sqrt(n)):
		return True
	else:
		return False
for i in arr:
	if i < 4:
		print('NO')
		continue
	if i == 4:
		print('YES')
		continue
	elif i % 2 == 1 and isPerfectSquare(i):
		sr = math.sqrt(i)
		sr = int(sr)
		if prime[sr]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi, log
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
from functools import cmp_to_key, reduce
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
mod = 1000000007
ch = 'abcdefghijklmnopqrstuvwxyz'
lcm = lambda a, b: a * b // gcd(a, b)
setbit = lambda x: bin(x)[2:].count('1')
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	for i in a:
		if i == 1:
			print('NO')
		else:
			grab = sqrt(i)
			if grab - floor(grab) != 0:
				print('NO')
			elif isPrime(int(grab)):
				print('YES')
			else:
				print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
solve()


import math
from sys import stdin, stdout

def get_it():
	seive = [True] * (10 ** 6 + 1)
	for i in range(2, 10 ** 3 + 1):
		if seive[i] == True:
			j = i * i
			while j < 10 ** 6 + 1:
				seive[j] = False
				j += i
	p_square = set()
	for i in range(2, len(seive)):
		if seive[i] == True:
			p_square.add(i * i)
	return p_square
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
p_square = get_it()
for i in range(n):
	if arr[i] in p_square:
		print('YES')
	else:
		print('NO')


from collections import deque, Counter
from itertools import combinations, permutations
from math import sqrt
import unittest

def read_int():
	return int(input().strip())

def read_int_array():
	return [int(i) for i in input().strip().split(' ')]
MAX = 10 ** 6

def calc_primes(n):
	seive = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if seive[i]:
			seive[i * i::i * 2] = [False] * ((n - i * i - 1) // (i * 2) + 1)
	return [2] + [i for i in range(3, n, 2) if seive[i]]
primes = set(calc_primes(MAX))
n = read_int()
for m in read_int_array():
	is_tprime = m != 1 and m ** 0.5 % 1 == 0 and (m ** 0.5 in primes)
	print('YES' if is_tprime else 'NO')


def Tout_Les_nbres_premiers():
	Liste_De_Premier = [True] * 1000000
	Liste_De_Premier[0] = Liste_De_Premier[1] = False
	for i in range(2, 1000000):
		if Liste_De_Premier[i] == True:
			for j in range(i * i, 1000000, i):
				Liste_De_Premier[j] = False
	return Liste_De_Premier

def estPrem(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if Liste_De_Premier[int(sqrt_n)] == True:
			return True
	return False
Liste_De_Premier = Tout_Les_nbres_premiers()
n = int(input())
L = list(map(int, input().split()))
for i in L:
	if estPrem(i) == True:
		print('YES')
	else:
		print('NO')


import math
limit = 1000000

def calculate_prime_flag_for_each_number_upto_limit():
	prime_flag = [True] * limit
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, limit):
		if prime_flag[i] == True:
			for j in range(i * i, limit, i):
				prime_flag[j] = False
	return prime_flag
pr = calculate_prime_flag_for_each_number_upto_limit()

def check_if_a_number_is_t_prime(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if pr[int(sqrt_n)] == True:
			return True
	return False
n = int(input())
x = [int(i) for i in input().split()]
for i in x:
	if check_if_a_number_is_t_prime(i):
		print('YES')
	else:
		print('NO')


from math import sqrt

def rl():
	return list(map(int, input().split()))

def isperfectsquare(num):
	if ceil(sqrt(num)) * ceil(sqrt(num)) == num:
		return (True, int(sqrt(num)))
	return (False, -1)
input()
inp = rl()
global sethai, arr
sethai = set()
arr = [True] * int(1000000.0 + 1)

def seive():
	(arr[0], arr[1]) = (False, False)
	for i in range(2, len(arr)):
		if arr[i]:
			for j in range(2 * i, len(arr), i):
				arr[j] = False
	for i in range(len(arr)):
		if arr[i]:
			sethai.add(i * i)
seive()
for i in inp:
	if i == 1:
		print('NO')
	elif i in sethai:
		print('YES')
	else:
		print('NO')


import math
input()
L = list(map(int, input().split(' ')))

def is_prime(n):
	if n == 1:
		return False
	if n == 2:
		return True
	k = 2
	while k * k <= n:
		if n % k == 0:
			return False
		k += 1
	return True

def helper(n):
	if n < 10:
		return n == 4 or n == 9
	k = int(math.sqrt(n))
	return k * k == n and is_prime(k)
for e in L:
	if helper(e):
		print('YES')
	else:
		print('NO')


def fact(n):
	if n % 2 == 0 and (not n == 2):
		return True
	for i in range(3, 1000, 2):
		if n % i == 0 and (not n == i):
			return True
	return False

def can_sqrt(a):
	p = 1
	q = 1000000
	while q - p > 1:
		v = (p + q) // 2
		v2 = v * v
		if v2 == a:
			return v
		elif v2 > a:
			q = v
		else:
			p = v
	return False
n = int(input())
x = map(int, input().split())
for i in x:
	sq = can_sqrt(i)
	if sq:
		if not fact(sq):
			print('YES')
			continue
	print('NO')


from math import sqrt

def get_prime(n):
	if n == 2:
		return [2]
	else:
		prime_sqrt_n = get_prime(int(sqrt(n - 1)) + 1)
		is_prime = [1] * (n - 1)
		for p in prime_sqrt_n:
			q = p
			while q < n // p + 1:
				is_prime[p * q - 2] = 0
				q += 1
		return [i for (i, j) in enumerate(is_prime, start=2) if j == 1]
prime_min = get_prime(10 ** 3)
input()
t_list = [*map(int, input().split())]
for squared_t in t_list:
	if squared_t in [4, 9, 25]:
		print('YES')
		continue
	elif squared_t % 2 == 0 or squared_t % 3 == 0 or squared_t % 5 == 0:
		print('NO')
		continue
	t = int(sqrt(squared_t))
	if squared_t % 2 == 0 or t ** 2 != squared_t or t == 1:
		print('NO')
		continue
	sqrt_t = int(sqrt(t)) + 1
	j = 0
	prime = True
	while prime_min[j] < sqrt_t:
		if t % prime_min[j] == 0:
			print('NO')
			prime = False
			break
		if j < len(prime_min) - 1:
			j += 1
		else:
			break
	if prime:
		print('YES')


def t(a):
	if a ** 0.5 - int(a ** 0.5) < 10 ** (-7) and a > 1:
		return True
	return False

def pr(l):
	c = 0
	for w in range(2, int(l ** 0.5) + 1):
		if l % w == 0:
			return False
	return True
n = int(input())
s = list(map(int, input().split()))
b = []
for i in range(len(s)):
	if t(s[i]) and pr(int(s[i] ** 0.5)):
		b.append('YES')
	else:
		b.append('NO')
for j in range(len(b)):
	print(b[j])


import math
t = int(input())
a = [int(i) for i in input().split()]
isPrime = [True] * (10 ** 6 + 1)
(isPrime[0], isPrime[1]) = (False, False)
for k in range(2, 1000 + 1):
	if isPrime[k]:
		for m in range(2, int(10 ** 6 / k) + 1):
			isPrime[m * k] = False
for i in a:
	root = int(math.sqrt(i))
	if root * root == i:
		if root > 1 and isPrime[root]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def primeList():
	priList = [True] * 1000000
	priList[0] = priList[1] = False
	for i in range(2, 1000000):
		if priList[i] == True:
			for j in range(i * i, 1000000, i):
				priList[j] = False
	return priList

def isPrime(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	m = n ** 0.5
	if m == int(m):
		if pList[int(m)] == True:
			return True
	return False
pList = primeList()
s = int(input())
r = list(map(int, input().split()))
for i in r:
	if isPrime(i) == True:
		print('YES')
	else:
		print('NO')


def sieveoferastosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
sieveoferastosthenes(10 ** 6)
x = int(input())
l = [int(x) for x in input().split()]
for i in range(x):
	if int(l[i] ** 0.5) ** 2 != l[i] or l[i] == 1:
		print('NO')
	elif prime[int(l[i] ** 0.5)] == True:
		print('YES')
	else:
		print('NO')


def is_prime(n):
	p = 2
	while p * p <= n:
		if b[p] == 1:
			for i in range(p * p, n + 1, p):
				b[i] = 0
		p = p + 1

def root(g):
	return int(g) ** (1 / 2)
b = [0, 0] + [1] * 10 ** 6
is_prime(10 ** 6)
n = int(input())
s = input().split()
s = list(map(root, s))
for num in s:
	if int(num) == num:
		if b[int(num)] == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
t = int(input())
arr = list(map(int, input().split()))
for i in range(t):
	k = 0
	x = arr[i]
	r = int(math.sqrt(x))
	if r * r == x and r != 1:
		z = 2
		while z * z <= r:
			if r % z == 0:
				print('NO')
				k = 1
				break
			else:
				z = z + 1
		if k == 0:
			print('YES')
	else:
		print('NO')


n = int(input())
l = map(int, input().split())

def sieve_of_eratosthenes(n):
	prime_squares = set()
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			prime_squares.add(p ** 2)
	return prime_squares
prime_squares = sieve_of_eratosthenes(1000001)
for i in l:
	if i in prime_squares:
		print('YES')
	else:
		print('NO')


def sieve():
	arr = [1 for i in range(10 ** 6 + 10)]
	(arr[0], arr[1]) = (0, 0)
	i = 2
	while i < len(arr):
		if arr[i] == 1:
			for j in range(2 * i, len(arr), i):
				arr[j] = 0
		i += 1
	return arr
n = int(input())
num = [int(i) for i in input().split()]
pa = sieve()
for i in num:
	if i ** 0.5 == int(i ** 0.5):
		if pa[int(i ** 0.5)] == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = 10 ** 6
prime = [1] * n
t_prime = set()
for i in range(2, n):
	if prime[i]:
		for j in range(i * i, n, i):
			prime[j] = 0
		t_prime.add(i * i)
_ = input()
for number in map(int, input().split()):
	if number in t_prime:
		print('YES')
	else:
		print('NO')


import math

def eladuosai(n):
	l = list(range(1, n + 1))
	l[0] = 0
	for i in range(2, n + 1):
		if l[i - 1] != 0:
			for j in range(i * 2, n + 1, i):
				l[j - 1] = 0
	result = [x for x in l if x != 0]
	return result
a = {x * x for x in eladuosai(1000000)}

def istprime(n):
	if n in a:
		return 'YES'
	else:
		return 'NO'
n = int(input())
lala = [int(x) for x in input().split()]
for la in lala:
	print(istprime(la))


from math import sqrt
primes = set()
m_val = 1000001
arr_was = [1] * m_val
arr_was[0] = 0
arr_was[1] = 0
arr_was[2] = 1
for (i, prime) in enumerate(arr_was):
	if prime == 1:
		primes.add(i)
		for d in range(i * i, m_val, i):
			arr_was[d] = 0
n = int(input())
x = input().split()
for i in x:
	num = int(sqrt(float(i)))
	if num * num == int(i):
		if num in primes:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def func(m):
	prime = [True for i in range(m + 1)]
	p = 2
	while p * p <= m:
		if prime[p] == True:
			for i in range(p * p, m + 1, p):
				prime[i] = False
		p = p + 1
	return prime
n = input()
l = [int(x) for x in input().split()]
m = int(max(l) ** 0.5)
b = func(m)
for i in l:
	if i != 1:
		if i ** 0.5 % 1 == 0:
			if b[int(i ** 0.5)] == True:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
lista = [int(i) for i in input().split(' ')]
primos = [True for i in range(1000001)]
primos[1] = False
for i in range(2, 1000001):
	if primos[i]:
		for j in range(i * i, 1000001, i):
			primos[j] = False
for i in lista:
	if math.sqrt(i) % 1 == 0 and primos[int(math.sqrt(i))]:
		print('YES')
	else:
		print('NO')


def sei(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for j in range(2 * p, n + 1, p):
				prime[j] = False
		p += 1
	prime[0] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			k.add(p * p)
k = set()
n = 1000005
sei(n)
n = int(input())
l = list(map(int, input().split()))
for i in l:
	if i in k:
		print('YES')
	else:
		print('NO')


def prime(n):
	primes = [False] * 2 + [True] * (n - 2)
	for p in range(2, int(n ** 0.5) + 1):
		if primes[p]:
			for i in range(2 * p, n, p):
				primes[i] = False
	primes_real = {}
	for j in range(n):
		if primes[j]:
			primes_real[j * j] = 1
	return primes_real
prime_lst = prime(1000000)
n = int(input())
lst = list(map(int, input().split()))
for each in lst:
	if each in prime_lst:
		print('YES')
	else:
		print('NO')


def Sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	prime[1] = False
	return prime
z = Sieve(1000000)
n = int(input())
a = list(map(int, input().split()))
for i in a:
	s = i ** 0.5
	if int(s) == s:
		if z[int(s)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	return prime
n = int(math.sqrt(10 ** 12) + 1)
list1 = SieveOfEratosthenes(n)
n = int(input())
list2 = list(map(int, input().split()))
for i in range(n):
	x = list2[i]
	(s1, s2) = str(math.sqrt(x)).split('.')
	if int(s2) == 0:
		if list1[int(s1)] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


pr = ['YES'] * (10 ** 6 + 1)
for i in range(1, 10 ** 6 + 1):
	if pr[i] == 'NO':
		continue
	elif i == 1:
		pr[i] = 'NO'
	else:
		for j in range(2 * i, 10 ** 6 + 1, i):
			pr[j] = 'NO'
n = int(input())
s = list(map(int, input().split()))
for p in s:
	k = p ** (1 / 2)
	if k != int(k):
		print('NO')
	else:
		print(pr[int(k)])


import math
n = int(input())
l = list(map(int, input().split()))

def isprime(i):
	if i == 1:
		return False
	if i == 2:
		return True
	for j in range(2, int(math.sqrt(i) + 1)):
		if i % j == 0:
			return False
	return True
for i in range(n):
	if math.sqrt(l[i]) == int(math.sqrt(l[i])) and isprime(int(math.sqrt(l[i]))):
		print('YES')
	else:
		print('NO')


n = int(input())
nums = [int(x) for x in input().split()]
sieve = [True] * 1000000
sieve[0] = False
sieve[1] = False
primes = set([])
for i in range(2, 1001):
	if sieve[i]:
		primes.add(i)
		for j in range(i, 1000000, i):
			sieve[j] = False
for i in range(1001, 1000000):
	if sieve[i]:
		primes.add(i)
for n in nums:
	if n == 1 or n == 2 or n == 3:
		print('NO')
		continue
	if int(n ** 0.5) ** 2 == n:
		p = int(n ** 0.5)
		if p in primes:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
mx = int(max(a) ** (1 / 2)) + 5
prs = [True for i in range(mx + 1)]
for i in range(2, int(mx ** (1 / 2)) + 1):
	for j in range(2 * i, mx + 1, i):
		prs[j] = False
prs[0] = prs[1] = False
print('\n'.join(('YES' if int(temp ** (1 / 2)) ** 2 == temp and prs[int(temp ** (1 / 2))] else 'NO' for temp in a)))


import math
n = int(input())
a = map(int, input().split())
s = set()
l = [True] * 1000001
l[0] = False
l[1] = False
for i in range(2, 1000001):
	if l[i]:
		for j in range(i * i, 1000001, i):
			l[j] = False
		s.add(i * i)
for i in a:
	if i in s:
		print('YES')
	else:
		print('NO')


n = int(input())
numbers = list(map(int, input().split()))
limit = 1000000
bs = [True] * limit
t_primes = set()

def sieve():
	bs[0] = False
	bs[1] = False
	for i in range(2, limit):
		if bs[i]:
			for j in range(i * i, limit, i):
				bs[j] = False
			t_primes.add(i * i)
sieve()
for number in numbers:
	if number in t_primes:
		print('YES')
	else:
		print('NO')


from math import sqrt, ceil

def sieve(n):
	prime = [True] * (n + 1)
	p = 2
	while p ** 2 <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	return prime
n = int(input())
xs = [int(i) for i in input().split(' ')]
sieve_table = sieve(ceil(sqrt(10 ** 12)))
for x in xs:
	if sqrt(x).is_integer() and sieve_table[ceil(sqrt(x))]:
		print('YES')
	else:
		print('NO')


a = [1] * 10 ** 6
a[0] = 0
for i in range(1, 10 ** 3, 1):
	if a[i] == 1:
		for j in range(2 * i + 1, 10 ** 6, i + 1):
			a[j] = 0
n = int(input())
l = [int(x) for x in input().split()]
for i in range(n):
	m = l[i]
	if m ** 0.5 % 1 == 0:
		r = int(m ** 0.5)
		if a[r - 1] == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
num_list = list(map(int, input().split()))
isPrime = [True for i in range(10 ** 6 + 1)]
isPrime[0] = isPrime[1] = False
for i in range(10 ** 3 + 1):
	if isPrime[i] == True:
		for j in range(i * i, 10 ** 6 + 1, i):
			isPrime[j] = False
from math import sqrt
for num in num_list:
	root = int(sqrt(num))
	if root * root == num and isPrime[root]:
		print('YES')
	else:
		print('NO')


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l = il()
b = [1] * 2 ** 20
s = set()
for i in range(2, 2 ** 20):
	if b[i]:
		for j in range(i * i, 2 ** 20, i):
			b[j] = 0
		s.add(i * i)
for i in l:
	print('YNEOS'[not i in s::2])


import math
seive = []
for i in range(1000001):
	seive.append(1)
(seive[0], seive[1]) = (0, 0)
for i in range(2, 1001):
	if seive[i] == 1:
		for j in range(i * i, 1000001, i):
			seive[j] = 0
n = int(input())
lis = [int(y) for y in input().split()]
for i in range(n):
	d = int(math.sqrt(lis[i]))
	if d * d == lis[i]:
		if seive[d] == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
sieve = []
for i in range(1000001):
	sieve.append(0)

def do_sieve():
	for i in range(2, 1000001):
		if not sieve[i]:
			for j in range(i, 1000001, i):
				sieve[j] = i
n = int(input())
a = [int(x) for x in input().split()]
do_sieve()
for x in a:
	sq = math.sqrt(x)
	rl = int(sq)
	if rl * rl == x and sieve[rl] == rl:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def chkprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
n = int(inp())
arr = lmp()
for i in range(n):
	p = int(sqrt(arr[i]))
	if pow(p, 2) == arr[i] and chkprime(p):
		out('YES')
	else:
		out('NO')


from math import sqrt
from bisect import bisect

def get_prime_squared(n):
	IsPrime = [True] * (n + 1)
	for i in range(2, int(n ** 0.5) + 1):
		if IsPrime[i]:
			for j in range(i * i, n + 1, i):
				IsPrime[j] = False
	return [x ** 2 for x in range(2, n + 1) if IsPrime[x]]
prime_squared = get_prime_squared(10 ** 6)
input()
t_list = [*map(int, input().split())]
for t in t_list:
	if t == prime_squared[bisect(prime_squared, t) - 1]:
		print('YES')
	else:
		print('NO')


def sieve(n: int) -> bool:
	if n == 2 or n == 3:
		return True
	if n < 2 or n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
input()
x = [int(i) ** 0.5 for i in input().split()]
for i in x:
	print(['NO', ['NO', 'YES'][sieve(int(i))]][i % 1 == 0])


def sieve(number):
	primes = [True] * (number + 1)
	i = 2
	primes[0] = False
	primes[1] = False
	while i * i <= number + 1:
		if primes[i]:
			for j in range(i * 2, number + 1, i):
				primes[j] = False
		i += 1
	return primes
prime = sieve(10 ** 6)
n = int(input())
ls = list(map(int, input().split()))
for i in ls:
	if i == 0:
		print('NO')
	elif round(i ** 0.5) ** 2 == i and prime[round(i ** 0.5)] == True:
		print('YES')
	else:
		print('NO')


limit = 1000000

def calculate_prime_flag_for_each_number_upto_limit():
	prime_flag = [True] * limit
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, limit):
		if prime_flag[i] == True:
			for j in range(i * i, limit, i):
				prime_flag[j] = False
	return prime_flag

def ctp(q):
	g = q ** 0.5
	if g - int(g) == 0 and (g % 10 % 2 != 0 or g == 2):
		if pf[int(g)] == True:
			return 1
	return 0
n = int(input())
a = list(map(int, input().strip().split(' ')))
pf = calculate_prime_flag_for_each_number_upto_limit()
for i in a:
	if ctp(i) == 1:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
a = [int(x) for x in input().split()]
n = int(math.sqrt(max(a))) + 1
prime = [1] * (n + 1)
tprime = set()
p = 2
while p * p <= n:
	if prime[p] == 1:
		for i in range(p * 2, n + 1, p):
			prime[i] = 0
	p += 1
for i in range(2, len(prime)):
	if prime[i] == 1:
		tprime.add(i * i)
for i in a:
	if i in tprime:
		print('YES')
	else:
		print('NO')


n = int(input())
num = list(map(int, input().split()))
a = 10 ** 6
res = [1, 1] + [0] * (a - 1)
for j in range(2, int(a ** 0.5)):
	if res[j] == 0:
		for i in range(j ** 2, a + 1, j):
			res[i] = 1
for k in num:
	b = k ** 0.5
	if b - int(b) == 0 and res[int(b)] == 0:
		print('YES')
	else:
		print('NO')


import math

def isprime(n):
	if n <= 3:
		return n > 1
	elif n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i += 6
	return True
n = int(input())
a = list(map(int, input().split()))
for i in a:
	if i <= 3:
		print('NO')
	else:
		sq = int(math.sqrt(i))
		if sq * sq == i:
			if isprime(sq):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


import sys, math
isprime = [0] * 1000010

def seive():
	isprime[1] = isprime[0] = 1
	limit = int(math.sqrt(1000010)) + 2
	for i in range(4, 1000010, 2):
		isprime[i] = 1
	for i in range(3, 1000010, 2):
		if not isprime[i]:
			if i <= limit:
				for j in range(i * i, 1000010, i * 2):
					isprime[j] = 1
seive()
n = int(input())
input_list = list(map(int, input().split()))
for i in input_list:
	x = int(math.sqrt(i))
	if i == x * x and (not isprime[x]):
		print('YES')
	else:
		print('NO')


import math
tprime = [0] * 2 + [1] * 1000001
for i in range(2, 1001):
	if tprime[i]:
		for j in range(i * 2, 1000001, i):
			tprime[j] = 0

def sq(n):
	a = math.sqrt(n)
	if a - math.floor(a) == 0:
		return a
	else:
		return 0
n = int(input())
l = [int(x) for x in input().split()]
for i in l:
	if sq(i) and tprime[int(sq(i))]:
		print('YES')
	else:
		print('NO')


import math

def is_prime(x):
	if x % 2 == 0:
		if x == 2:
			return 1
		return 0
	for i in range(3, round(math.sqrt(x)) + 1, 2):
		if x % i == 0:
			return 0
	return 1
n = int(input())
a = [int(i) for i in input().split()]
for i in a:
	if i == 1:
		print('NO')
		continue
	x = round(math.sqrt(i))
	print('YES') if x * x == i and is_prime(x) else print('NO')


import math
n = int(input())
checkPrime = []
numbers = [int(x) for x in input().split()]
for i in range(0, 1000000 + 1):
	checkPrime.append(1)
checkPrime[0] = 0
checkPrime[1] = 0
for i in range(2, 1000 + 1):
	if checkPrime[i] == 1:
		for j in range(i + i, 1000000 + 1, i):
			checkPrime[j] = 0
for number in numbers:
	check = True
	sqrt = int(math.sqrt(number))
	if sqrt ** 2 != number:
		check = False
	if check and checkPrime[sqrt] == 1:
		print('YES')
	else:
		print('NO')


n = int(input(''))
L = list(map(int, input().split(' ')))
L1 = [1] * 1000000
l = set()
for k in range(2, 1000000):
	if L1[k] != 0:
		l.add(k ** 2)
		for j in range(k ** 2, 1000000, k):
			L1[j] = 0
for k in L:
	if k in l:
		print('YES')
	else:
		print('NO')


from math import sqrt
n = int(input())
x = list(map(int, input().split()))

def t(a):
	if sqrt(a) - int(sqrt(a)) != 0 or a == 1:
		return False
	a = int(sqrt(a))
	d = 2
	k = 0
	for i in range(1, int(sqrt(a)) + 1):
		if a % i == 0:
			k += 2
	return k == 2
for i in x:
	if t(i):
		print('YES')
	else:
		print('NO')


import math
k = 1000002
prime = [True] * k
p = 2
while p * p <= k:
	if prime[p]:
		for i in range(p * p, k, p):
			prime[i] = 0
	p += 1
(prime[0], prime[1]) = (0, 0)
n = int(input())
l = list(map(int, input().split()))
for i in l:
	sq = int(math.sqrt(i))
	if math.floor(math.sqrt(i)) != math.sqrt(i):
		print('NO')
	elif prime[sq]:
		print('YES')
	else:
		print('NO')


import math
inp = lambda : map(int, input().rstrip().split())
n = inp()
x = list(inp())

def isPrime(a):
	sq = int(math.sqrt(a))
	if a in [2, 3, 5, 7, 11]:
		return True
	for i in range(2, sq + 2):
		if a % i == 0:
			return False
	return True
for i in x:
	sq = math.sqrt(i)
	if i != 1 and sq.is_integer() and (isPrime(int(sq)) == True):
		print('YES')
	else:
		print('NO')


m = 1000001
sieve = [True] * m
i = 2
while i < m:
	if sieve[i]:
		for j in range(i + i, m, i):
			sieve[j] = False
	i += 1
sieve[0] = False
sieve[1] = False
primes = {i for (i, e) in enumerate(sieve) if e}
n = int(input())
queries = [int(c) for c in input().split()]
for q in queries:
	sqrt = int(q ** 0.5)
	print('YES' if sqrt * sqrt == q and sqrt in primes else 'NO')


from math import sqrt
dict = {}
from collections import defaultdict
dict = defaultdict(lambda : 0, dict)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	y = []
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for i in range(2, len(prime)):
		if prime[i]:
			y.append(i)
	return y
t = SieveOfEratosthenes(1000000)
for i in t:
	dict[i * i] = 1
n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	if dict[a[i]] == 1:
		print('YES')
	else:
		print('NO')


import math
prime = [True for i in range(10 ** 6 + 1)]
p = 2
while p * p <= 10 ** 6:
	if prime[p]:
		for i in range(p * p, 10 ** 6 + 1, p):
			prime[i] = False
	p += 1
n = int(input())
arr = [int(i) for i in input().split()]
for e in arr:
	if e > 1:
		r = e ** 0.5
		fr = math.floor(r)
		diff = r - fr
		if diff == 0 and prime[fr]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


input()
l = 1000002
c = [1, 1] + [0] * l
for i in range(2, l):
	if 1 - c[i]:
		for j in range(i * i, l, i):
			c[j] = 1
for i in input().split():
	i = int(i)
	r = int(i ** 0.5)
	print('YNEOS'[c[r] or r * r != i::2])


from math import sqrt
t = int(input())
x = list(map(int, input().split()))
primes = [True] * (1000000 + 1)
primes[0] = False
primes[1] = False
p = 2
while p * p < len(primes):
	if primes[p] == True:
		for i in range(p * p, len(primes), p):
			primes[i] = False
	p += 1

def tprimes(num):
	n = int(sqrt(num))
	if n * n != num:
		return 'NO'
	if primes[n]:
		return 'YES'
	return 'NO'
for num in x:
	print(tprimes(num))


n = int(input())
line = [int(x) for x in input().split()]
m = 10 ** 6
prime = [True] * (m + 1)
p = 2
temp = set()
for i in range(2, m + 1):
	if prime[i]:
		for j in range(i * i, m + 1, i):
			prime[j] = False
		temp.add(i ** 2)
for i in line:
	print(['NO', 'YES'][i in temp])


t = int(input())
vars = list(map(int, input().rstrip().split()))
limit = 1000000
allPrimes = [True] * (limit + 1)
allPrimes[0] = allPrimes[1] = False
for i in range(2, 1001):
	if allPrimes[i]:
		j = i * 2
		while j <= limit:
			allPrimes[j] = False
			j += i
for k in vars:
	if int(k ** 0.5) * int(k ** 0.5) == k and allPrimes[int(k ** 0.5)]:
		print('YES')
	else:
		print('NO')


import math

def sieveOfEratosthenes(n):
	primes = [True for i in range(n + 1)]
	primes[1] = False
	p = 2
	while p * p <= n:
		if primes[p] == True:
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return primes
n = int(input())
a = list(map(int, input().split()))
isPrime = sieveOfEratosthenes(10 ** 6 + 1)
for i in a:
	if int(math.sqrt(i)) == math.sqrt(i) and isPrime[int(math.sqrt(i))]:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
l = list(map(int, input().split()))
for i in l:
	s = int(math.sqrt(i))
	if s * s == i:
		k = 0
		if s == 1:
			print('NO')
		elif s == 2 or s == 3:
			print('YES')
		elif s % 2 == 0:
			print('NO')
		elif s % 3 == 0:
			print('NO')
		else:
			c = 5
			while c * c <= s:
				if s % c == 0 or s % (c + 2) == 0:
					print('NO')
					k = 1
					break
				c += 6
			if k == 0:
				print('YES')
	else:
		print('NO')


import math

def is_prime(n):
	if n in [0, 1]:
		return False
	if n == 2:
		return True
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
n = int(input())
arr = input().strip().split()
for i in arr:
	i = int(i)
	if i in [0, 1, 2]:
		print('NO')
	else:
		sq = math.sqrt(i)
		if sq == int(sq):
			if is_prime(int(sq)):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


n = 1000001
a = [1] * n
(a[0], a[1]) = (0, 0)
for i in range(2, int(n ** 0.5)):
	if a[i] == 1:
		for j in range(i, (n - 1) // i + 1):
			a[j * i] = 0
m = int(input())
for x in map(int, input().split()):
	b = x ** 0.5
	if b == int(b) and a[int(b)] == 1:
		print('YES')
	else:
		print('NO')


from math import sqrt

def sieve(n):
	arr = [True] * (n + 1)
	arr[0] = False
	arr[1] = False
	i = 2
	while i * i <= n:
		if arr[i] == True:
			for j in range(2 * i, n + 1, i):
				if arr[j] == True:
					arr[j] = False
		i += 1
	return arr

def isPrime(n):
	if n == 1:
		return False
	if n == 2:
		return True
	if n % 2 == 0:
		return False
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def isSquare(n):
	if int(sqrt(n)) * int(sqrt(n)) == n:
		return True
	return False
n = int(input().strip())
x = list(map(int, input().strip().split()))[:n]
arr = sieve(10 ** 6)
for i in x:
	if isSquare(i):
		if arr[int(sqrt(i))] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import ceil, sqrt
n = int(input())
l = list(map(int, input().split()))

def tprime(n):
	ans = 0
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			ans = 1
			break
	if ans == 1:
		return 'NO'
	else:
		return 'YES'
for i in range(n):
	t = sqrt(l[i])
	if l[i] != 1 and int(t) == t:
		print(tprime(int(t)))
	else:
		print('NO')


import math

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def tfactors(n):
	num = math.sqrt(n)
	if num - math.floor(num) == 0:
		num = int(num)
		if prime[num]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
n = int(input())
arr = list(map(int, input().split()))
prime = SieveOfEratosthenes(int(math.sqrt(max(arr))))
for i in range(n):
	if arr[i] == 1:
		print('NO')
	else:
		tfactors(arr[i])


input()
d = [int(x) for x in input().split()]
out = []
from math import sqrt as fsqrt

def sqrt(x):
	f = int(fsqrt(x))
	if f * f == x:
		return f
	if (f + 1) * (f + 1) == x:
		return f + 1
	return -1
pt = [1337, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0]

def prime(x):
	if x < 10:
		return pt[x]
	for d in range(2, int(fsqrt(x)) + 2):
		if x % d == 0:
			return 0
	return 1
y = 'YES'
n = 'NO'
for x in d:
	xx = sqrt(x)
	if xx == -1:
		out.append(n)
		continue
	out.append(y if prime(xx) else n)
print('\n'.join(out))


def crivo():
	n = 1000000
	pr = [True] * (n + 1)
	pr[0] = pr[1] = False
	for i in range(2, n + 1):
		if pr[i] and i * i <= n:
			for j in range(i * i, n + 1, i):
				pr[j] = False
	return pr
l = crivo()
n = input()
t = [int(i) for i in input().split()]
for i in t:
	i = i ** (1 / 2)
	if i.is_integer():
		i = int(i)
		if l[i]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt
limits = 1000000
prime_flag_list = [True] * limits
prime_flag_list[0] = prime_flag_list[1] = False
for i in range(2, int(sqrt(limits))):
	if prime_flag_list[i] == True:
		for j in range(i * i, limits, i):
			prime_flag_list[j] = False

def is_t_prime(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	if sqrt(n) == int(sqrt(n)):
		return prime_flag_list[int(sqrt(n))]
	return False
input()
numbers = list(map(int, input().split()))
for i in numbers:
	print('YES' if is_t_prime(i) else 'NO')


input()
n = 1000001
t = [int(x) for x in input().split()]
prime = [1] * n
prime[0] = 0
prime[1] = 0
s = set()
for i in range(2, n):
	if prime[i]:
		s.add(i * i)
		for j in range(i * 2, n, i):
			prime[j] = 0
for x in t:
	print('YES' if x in s else 'NO')


n = int(input())
a = []
s = input().split()
for i in range(n):
	a.append(int(s[i]))

def se(n, prime):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
prime = [True] * (10 ** 7 + 1)
se(int(max(a) ** 0.5) + 1, prime)
for i in range(n):
	if int(a[i] ** 0.5) != a[i] ** 0.5 or a[i] == 1:
		print('NO')
	else:
		x = int(a[i] ** 0.5)
		if prime[x] == True:
			print('YES')
		else:
			print('NO')


n = int(input())
list1 = list(map(int, input().split()))

def prime(k):
	if k <= 1:
		return 0
	else:
		for l in range(2, int(k ** 0.5) + 1):
			if k % l == 0:
				return 0
		return 1
for m in range(n):
	if list1[m] ** 0.5 == int(list1[m] ** 0.5) and prime(int(list1[m] ** 0.5)) == 1:
		print('YES')
	else:
		print('NO')


l = int(input())
m = list(map(float, input().split()))
l = [False] * 1000006
for i in range(2, 1000006):
	if l[i] == False:
		for j in range(2 * i, 1000006, i):
			l[j] = True
for i in m:
	if i == 1:
		print('NO')
	elif (i ** (1 / 2)).is_integer():
		if not l[int(i ** (1 / 2))]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
from bisect import bisect_left

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1
primes = []

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n):
		if prime[p]:
			primes.append(p)
SieveOfEratosthenes(1000000)
n = int(input())
lst = [int(i) for i in input().split()][:n]
for n in lst:
	k = int(math.sqrt(n))
	if k * k == n:
		if BinarySearch(primes, k) != -1:
			print('YES')
			continue
	print('NO')


lim = 10 ** 6
val = [1] * lim
a = set()
a.add(4)
for i in range(2, lim):
	if val[i]:
		for j in range(i * i, lim, i):
			val[j] = 0
		a.add(i * i)
input()
for i in list(map(int, input().split())):
	if i in a:
		print('YES')
	else:
		print('NO')


MAXN = 1000000
is_prime = [True] * MAXN
T_prime = set()
for i in range(2, MAXN):
	if is_prime[i]:
		T_prime.add(i * i)
		for j in range(i * i, MAXN, i):
			is_prime[j] = False
input()
for i in [int(x) for x in input().split()]:
	print('YES') if i in T_prime else print('NO')


from math import sqrt
memo = dict()
(memo[0], memo[1]) = (False, False)

def isPrime(N):
	if N in memo:
		return memo[N]
	rt = int(sqrt(N))
	cnt = 0
	for i in range(1, rt + 1):
		if N % i == 0:
			cnt += 1
	memo[N] = True if cnt <= 1 else False
	return memo[N]
N = int(input())
nums = [int(x) for x in input().split()]
for n in nums:
	rt = sqrt(n)
	if rt.is_integer() and isPrime(int(rt)) and (int(rt * rt) == n):
		print('YES')
	else:
		print('NO')


def eratosthenes(n):
	lis = [0 for i in range(n + 1)]
	lis2 = []
	for i in range(2, n + 1):
		if lis[i] == 0:
			lis2.append(i)
			for j in range(i * 2, n + 1):
				if j % i == 0:
					lis[j] = 1
	return lis2
p = eratosthenes(1000)
import math
n = int(input())
li = [int(r) for r in input().split()]
for k in range(n):
	q = int(math.sqrt(li[k]))
	if q == 1:
		print('NO')
	elif q ** 2 != li[k]:
		print('NO')
	else:
		for m in p:
			if q % m == 0 and q not in p:
				print('NO')
				break
		else:
			print('YES')


import math
n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	d = 0
	b = int(math.sqrt(a[i]))
	if b ** 2 == a[i]:
		c = int(math.sqrt(b))
		for j in range(1, c):
			if b % (j + 1) == 0:
				d = 1
				break
	else:
		d = 1
	if a[i] == 1:
		print('NO')
	elif d == 0 or a[i] == 4:
		print('YES')
	else:
		print('NO')


from math import sqrt

def prime(x):
	if x <= 1:
		return 0
	if x <= 3:
		return 1
	if x % 2 == 0 or x % 3 == 0:
		return 0
	i = 5
	while i * i <= x:
		if x % i == 0 or x % (i + 2) == 0:
			return 0
		i += 6
	return 1
N = int(input())
A = list(map(int, input().split()))
for i in A:
	k = sqrt(i)
	m = int(k)
	if m != sqrt(i):
		print('NO')
	elif k in [2, 3]:
		print('YES')
	elif k % 2 == 0 or k % 3 == 0:
		print('NO')
	elif prime(m) == 1:
		print('YES')
	else:
		print('NO')


su = [True for i in range(1000000)]
r = set()
for i in range(2, 1000000):
	if su[i]:
		for j in range(i * i, 1000000, i):
			su[j] = False
		r.add(i * i)
n = int(input())
m = [int(i) for i in input().split()]
for k in m:
	if k in r:
		print('YES')
	else:
		print('NO')


import sys
import string
import math
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache
from fractions import Fraction

def mi(s):
	return map(int, s.strip().split())

def lmi(s):
	return list(mi(s))

def tmi(s):
	return tuple(mi(s))

def mf(f, s):
	return map(f, s)

def lmf(f, s):
	return list(mf(f, s))

def js(lst):
	return ' '.join((str(d) for d in lst))

def jsns(lst):
	return ''.join((str(d) for d in lst))

def line():
	return sys.stdin.readline().strip()

def linesp():
	return line().split()

def iline():
	return int(line())

def mat(n):
	matr = []
	for _ in range(n):
		matr.append(linesp())
	return matr

def matns(n):
	mat = []
	for _ in range(n):
		mat.append([c for c in line()])
	return mat

def mati(n):
	mat = []
	for _ in range(n):
		mat.append(lmi(line()))
	return mat

def pmat(mat):
	for row in mat:
		print(js(row))

def prime(n):
	primes = [True for _ in range(n + 1)]
	primes[0] = False
	primes[1] = False
	for i in range(2, n + 1):
		if i * i > n:
			break
		if primes[i]:
			for j in range(i * i, n + 1, i):
				primes[j] = False
	return primes

def main():
	n = iline()
	arr = lmi(line())
	pp = prime(int(1000000.0 + 2))
	ans = set((i * i for i in range(len(pp)) if pp[i]))
	for n in arr:
		if n in ans:
			print('YES')
		else:
			print('NO')
main()


import math

class prnum:

	def calprnum(n):
		lp = []
		for i in range(2, n + 1):
			s = math.sqrt(i)
			k = 0
			for j in range(2, int(s) + 1):
				if i % j == 0:
					k = 1
					break
			if k == 0:
				list.append(lp, i)
		return lp
prime = prnum.calprnum(1050)
n = int(input())
arr = str(input()).split()
for i in range(n):
	s = int(arr[i])
	ss = math.sqrt(s)
	if s == 1:
		print('NO')
	elif int(ss) != ss:
		print('NO')
	else:
		ss = int(ss)
		for j in prime:
			if ss % j == 0 and ss != j:
				print('NO')
				break
			elif j > math.sqrt(ss):
				print('YES')
				break


import sys
input = sys.stdin.readline
dp = [False] * 1000001

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def build_sieve():
	dp[1] = True
	for i in range(2, 1000):
		if not dp[i]:
			j = 2
			while i * j <= 1000000:
				dp[i * j] = True
				j += 1

def solve(arr):
	for a in arr:
		if a in [1, 2, 3]:
			print('NO')
			continue
		if a == 4:
			print('YES')
			continue
		if a % 2 == 0:
			print('NO')
			continue
		sq = a ** 0.5
		if not sq.is_integer():
			print('NO')
			continue
		if dp[int(sq)]:
			print('NO')
			continue
		print('YES')
n = inp()
build_sieve()
arr = inlt()
solve(arr)


n = int(input())
L = [int(s) for s in input().split()]

def SleveOfEratosthenes(SE):
	prime = [1 for i in range(SE + 1)]
	p = 2
	while p * p <= SE:
		if prime[p]:
			for i in range(2 * p, SE + 1, p):
				prime[i] = 0
		p += 1
	prime[0] = prime[1] = 0
	return prime
SElist = SleveOfEratosthenes(10 ** 6)
for n in L:
	a = int(n ** 0.5)
	print('YES') if n == a ** 2 and SElist[a] else print('NO')


h = int((10 ** 12) ** 0.5)
p = list(range(3, h + 1, 2))
j = 0
for i in range(len(p)):
	if p[j]:
		p[j + p[j]:len(p):p[j]] = [0] * len(p[j + p[j]:len(p):p[j]])
	j += 1
p = set(filter(None, p))
p.add(2)
n = int(input())
k = list(map(int, input().split()))
for i in k:
	if i ** 0.5 in p:
		print('YES')
	else:
		print('NO')


n = 2 ** 20
a = [1] * n
r = {4}
for i in range(2, n):
	if a[i]:
		for j in range(i * i, n, i):
			a[j] = 0
		r.add(i * i)
input()
for d in map(int, input().split()):
	print(['NO', 'YES'][d in r])


def generate(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for j in range(p * p, n + 1, p):
				prime[j] = False
		p = p + 1
	return prime
limit = pow(10, 6)
ok = generate(limit)
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in a:
	z = int(pow(i, 0.5))
	if z * z == i and z != 1:
		if ok[z] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def prostoe(x):
	global prostye
	return x in prostye
import sys
n = int(sys.stdin.readline())
x = list(map(int, sys.stdin.readline().split()))
m = min(x)
nn = round(max(x) ** 0.5)
a = list(range(nn + 1))
prostye = {}
i = 2
while i <= nn:
	if a[i] != 0:
		if a[i] ** 2 >= m:
			prostye[a[i] ** 2] = 1
		for j in range(i, nn + 1, i):
			a[j] = 0
	i += 1
for i in x:
	if prostoe(i):
		print('YES')
	else:
		print('NO')


import math
m = int(math.sqrt(10 ** 12))
isPrime = [False for i in range(m + 1)]
(isPrime[0], isPrime[1]) = (True, True)
for i in range(4, m + 1, 2):
	isPrime[i] = True
for i in range(3, int(math.sqrt(m + 1)), 2):
	if isPrime[i] == False:
		for j in range(i * i, m + 1, 2 * i):
			isPrime[j] = True
n = int(input())
tp = list(map(int, input().split(' ')))
for i in tp:
	sq = int(math.sqrt(i))
	if sq * sq == i and isPrime[sq] == False:
		print('YES')
	else:
		print('NO')


n = int(input())
X = list(map(int, input().split()))
limit = int(max(X) ** 0.5)
prime = [True for i in range(limit + 1)]
(p, prime[0], prime[1]) = (2, False, False)
while p * p <= limit:
	if prime[p]:
		for i in range(p * 2, limit + 1, p):
			prime[i] = False
	p += 1
for x in X:
	p = x ** 0.5
	if int(p) == p and prime[int(p)]:
		print('YES')
	else:
		print('NO')


import math
n = 1000001
Isprime = [True] * n
(Isprime[0], Isprime[1]) = (False, False)
for i in range(2, int(math.sqrt(n))):
	if Isprime[i] == True:
		for j in range(i, (n - 1) // i + 1):
			Isprime[j * i] = False
m = int(input())
for X in input().split():
	x = int(X)
	y = math.sqrt(x)
	if y == int(y) and Isprime[int(y)]:
		print('YES')
	else:
		print('NO')


limit = 1000000

def calculate():
	prime_flag = [True] * limit
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, limit):
		if prime_flag[i] == True:
			for j in range(i * i, limit, i):
				prime_flag[j] = False
	return prime_flag

def check(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sroot = n ** 0.5
	if sroot == int(sroot):
		if prime_flag[int(sroot)] == True:
			return True
	return False
prime_flag = calculate()
total_numbers = int(input())
input_array = list(map(int, input().split()))
for i in input_array:
	if check(i) == True:
		print('YES')
	else:
		print('NO')


import math

def sieve_of_eratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
sieve_of_eratosthenes(1000001)
test_case = int(input())
vals = [int(x) for x in input().split()]
for val in vals:
	sqr_val = int(math.sqrt(val))
	if sqr_val * sqr_val != val:
		print('NO')
	elif prime[sqr_val] == True:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
a = [int(x) for x in input().split()]
x = math.ceil(max(a) ** 0.5)
l = [True] * (x + 1)
for i in range(2, x + 1):
	if l[i - 1]:
		j = i
		while j * i <= x:
			l[j * i - 1] = False
			j += 1
for i in range(n):
	x = a[i] ** 0.5
	if x != int(x) or x == 1:
		print('NO')
	elif l[int(x) - 1]:
		print('YES')
	else:
		print('NO')


from math import *
from sys import stdin
from sys import stdout
sprint = stdout.write
sinput = stdin.readline

def is_prime(a):
	m = int(sqrt(a))
	if a % 2 == 0 and a != 2:
		return 'NO\n'
	for i in range(3, m + 1, 2):
		if a % i == 0:
			return 'NO\n'
	return 'YES\n'
n = int(sinput())
arr = [int(x) for x in sinput().split()]
for i in arr:
	if int(sqrt(i)) ** 2 == i and i != 1 and int(sqrt(i)):
		sprint(is_prime(int(sqrt(i))))
	else:
		sprint('NO\n')


def sieve(n):
	prime = [True for i in range(n + 1)]
	prime[0] = False
	prime[1] = False
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
list_prime = sieve(10 ** 6 + 1)
k = input()
num = [int(x) for x in input().split()]
for j in num:
	if j ** 0.5 == int(j ** 0.5) and list_prime[int(j ** 0.5)]:
		print('YES')
	else:
		print('NO')


def genProst(m):
	res = [True] * (m + 1)
	(res[0], res[1]) = (False, False)
	i = 2
	while i <= m:
		while i <= m and res[i] == False:
			i += 1
		j = i * 2
		while j <= m:
			res[j] = False
			j += i
		i += 1
	return res
n = int(input())
a = [int(x) for x in input().split()]
prost = genProst(int(max(a) ** 0.5))
for j in range(len(a)):
	k = a[j] ** 0.5
	if k // 1 != k or k == a[j]:
		print('NO')
	elif prost[int(k)] == True:
		print('YES')
	else:
		print('NO')


import sys
import math

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def sinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def ninp():
	return map(int, sys.stdin.readline().strip().split())

def linp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(a):
	print(a)
n = int(input())
N = 1000000
a = [1] * N
a[0] = a[1] = 0
s = set()
for (i, j) in enumerate(a):
	if j:
		s.add(i * i)
		for k in range(2 * i, N, i):
			a[k] = 0
for x in map(int, input().split()):
	if x in s:
		print('YES')
	else:
		print('NO')


import math
n = int(math.sqrt(10 ** 12))
prime = [True for i in range(n + 1)]
p = 2
while p * p <= n:
	if prime[p]:
		for i in range(p * p, n + 1, p):
			prime[i] = False
	p += 1
s = set()
for i in range(2, len(prime)):
	if prime[i]:
		s.add(i)
t = int(input())
l = list(map(int, input().split()))
for i in range(t):
	if math.sqrt(l[i]) in s:
		print('YES')
	else:
		print('NO')


import math

def primelist(n):
	prime = [True for i in range(n + 1)]
	p = 2
	primeno = set()
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for i in range(2, n + 1):
		if prime[i]:
			primeno.add(i * i)
	return primeno
n = int(input())
x = list(map(int, input().rstrip().split()))
maxnum = math.sqrt(max(x)) + 1
arr = primelist(int(maxnum))
for i in range(len(x)):
	if x[i] in arr:
		print('YES')
	else:
		print('NO')


import bisect
from math import sqrt
primecheck = [0, 0] + [1] * 999999
for i in range(2, 1001):
	if primecheck[i] == 1:
		k = 1000000 // i
		for j in range(2, k + 1):
			primecheck[i * j] = 0

def tprime(x):
	s = int(sqrt(x))
	return s * s == x and primecheck[s] == 1
n = int(input())
l = [int(x) for x in input().split()]
for k in l:
	if tprime(k):
		print('YES')
	else:
		print('NO')


int(input())
x = list(map(int, input().split()))
n = int(max(x) ** 0.5)
mark = [False] * (n + 1)
mark[0] = mark[1] = True
primes = set()
for i in range(2, n + 1):
	if mark[i] == False:
		primes.add(i)
		for j in range(i + i, n + 1, i):
			mark[j] = True
for i in x:
	t = i ** 0.5
	if t == int(t) and int(t) in primes:
		print('YES')
	else:
		print('NO')


import math
from collections import Counter

def get(f):
	return map(f, input().split())

def divides(a, b):
	return a % b == 0

def sieve(upper):
	primes = []
	marked = [False for i in range(upper)]
	marked[0] = True
	marked[1] = True
	for i in range(2, upper):
		if not marked[i]:
			primes.append(i)
			for j in range(i, upper, i):
				marked[j] = True
	return primes

def main():
	n = int(input())
	nums = get(int)
	upper = int(1000000.0)
	primes = set(map(lambda x: x * x, sieve(upper)))
	for i in nums:
		if i in primes:
			print('YES')
		else:
			print('NO')
main()


(c, s) = ([1] * 10 ** 6, set())
for i in range(2, 10 ** 6):
	if c[i]:
		c[i * i::i] = [0] * ((10 ** 6 - 1) // i - i + 1)
		s.add(i * i)
input()
for x in list(map(int, input().split())):
	print('YES' if x in s else 'NO')


n = int(input())
a = list(map(int, input().split()))
s = set()
maxn = 1000001
vis = [1] * maxn
for i in range(2, maxn):
	if vis[i]:
		s.add(i * i)
		for j in range(2 * i, maxn, i):
			vis[j] = 0
for i in a:
	print('YES') if i in s else print('NO')


n = int(input())
x = int(1000009)
mark = [True] * x
r = {4}
for i in range(2, x):
	if mark[i]:
		for j in range(i * i, x, i):
			mark[j] = False
		r.add(i * i)
for j in map(int, input().split()):
	if j in r:
		print('YES')
	else:
		print('NO')


def is_composite(num1):
	if num1 == 1:
		return True
	for j in range(2, int(num1 ** 0.5) + 1):
		if num1 % j == 0:
			return True
	return False

def is_t_prime(a):
	if a % 2 == 0 and a > 4:
		return 'NO'
	if a ** 0.5 % 1 != 0:
		return 'NO'
	elif is_composite(int(a ** 0.5)):
		return 'NO'
	else:
		return 'YES'
n = int(input())
arr = input().split()
for i in arr:
	print(is_t_prime(int(i)))


MAX_P = 1000010
tprimes = set()
is_prime = [True] * MAX_P
for i in range(2, MAX_P):
	if is_prime[i]:
		tprimes.add(i * i)
		for j in range(i * i, MAX_P, i):
			is_prime[j] = False
n = int(input())
values = map(int, input().split())
for v in values:
	print('YES' if v in tprimes else 'NO')


import collections
import itertools
import sys
from bisect import bisect_left
from collections import defaultdict, Counter
from math import sqrt, ceil
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def pr(a):
	r = sqrt(a)
	for i in range(2, int(r) + 1):
		if a % i == 0:
			return i
	return None

def main():
	n = inp()
	v = inlt()
	for d in v:
		if d == 1:
			print('NO')
			continue
		r = int(sqrt(d))
		if r * r == d and (not pr(r)):
			print('YES')
		else:
			print('NO')
main()


n = int(input())
nums = [int(i) for i in input().split()]

def prime_list(n):
	prime_bool = [True for i in range(n + 1)]
	(prime_bool[0], prime_bool[1]) = (False, False)
	i = 2
	while i ** 2 <= n:
		if prime_bool[i]:
			for j in range(2 * i, n, i):
				prime_bool[j] = False
		i += 1
	return prime_bool
prime_bool_list = prime_list(10 ** 6 + 1)
for num in nums:
	if num ** 0.5 == int(num ** 0.5) and prime_bool_list[int(num ** 0.5)]:
		print('YES')
	else:
		print('NO')

def all_primes(n):
	is_existing = [True for i in range(n + 1)]
	(num, primes) = (2, [])
	while num ** 2 <= n:
		if is_existing[num]:
			primes.append(num)
			for i in range(num ** 2, n + 1, num):
				is_existing[i] = False
		num += 1
	return primes

def is_prime(n):
	if n <= 1 or int(n) != n:
		return False
	else:
		i = 2
		while i ** 2 <= n:
			if n % i == 0:
				return False
			i += 1
		return True


from math import sqrt

def isPrime(num):
	if num < 2:
		return False
	for i in range(2, int(sqrt(num)) + 1):
		if num % i == 0:
			return False
	return True
n = int(input())
a = list(map(int, input().split()))
for i in a:
	temp = int(sqrt(i))
	b = isPrime(temp)
	if b and temp * temp == i:
		print('YES')
	else:
		print('NO')


import sys
from math import sqrt

def write_to_stdout(res):
	answer = '\n'.join(res)
	sys.stdout.write('%s\n' % answer)

def read_input():
	l = input().rstrip().split()
	values = input().rstrip().split()
	return [int(i) for i in values]

def get_primes_set():
	N = 1000000
	mask = [1] * N
	for i in range(2, N):
		if mask[i]:
			for j in range(2 * i, N, i):
				mask[j] = 0
	res = []
	for k in range(2, len(mask)):
		if mask[k]:
			res.append(k)
	return set(res)

def is_t_prime(n, primes):
	n_sqrt = sqrt(n)
	if n_sqrt != int(n_sqrt) or n == 1:
		return False
	if n_sqrt in primes:
		return True
	return False

def get_answer(values, primes):
	ans = []
	for val in values:
		if is_t_prime(val, primes):
			ans.append('YES')
		else:
			ans.append('NO')
	return ans

def main():
	values = read_input()
	primes = get_primes_set()
	answer = get_answer(values, primes)
	write_to_stdout(answer)
main()


def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
import math
n = 10 ** 6
prime = [True for i in range(n + 1)]
p = 2
while p * p <= n:
	if prime[p] == True:
		for i in range(p * 2, n + 1, p):
			prime[i] = False
	p += 1
prime[0] = False
prime[1] = False
primes = dict()
for p in range(n, -1, -1):
	if prime[p]:
		primes[p] = p
	del prime[p]

def solve():
	N = getInt()
	A = getInts()
	for a in A:
		z = math.sqrt(a)
		if z == int(z) and z in primes:
			print('YES')
		else:
			print('NO')
solve()


def sieve(n: int) -> list:
	ary = [True] * (n + 1)
	ary[0] = ary[1] = False
	for i in range(4, n + 1, 2):
		ary[i] = False
	m = int(n ** 0.5) + 1
	for i in range(3, m, 2):
		if ary[i]:
			for j in range(i * i, n + 1, i):
				ary[j] = False
	return ary
n = int(input())
ary = list(map(int, input().strip().split()))
prime_bool = sieve(int(max(ary) ** 0.5))
for i in ary:
	if i ** 0.5 - int(i ** 0.5) == 0:
		if prime_bool[int(i ** 0.5)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
m = 1000000
prime = [True] * (m + 1)
prime[0] = prime[1] = False
for i in range(2, m + 1):
	if prime[i]:
		j = i * i
		while j <= m:
			prime[j] = False
			j += i
n = int(input())
temp = input().split()
for n in temp:
	num = int(n)
	f = math.sqrt(int(num))
	if f - int(f) == 0 and prime[int(f)]:
		print('YES')
	else:
		print('NO')


num = int(input())
line = [int(x) for x in input().split()]
k = int(max(line) ** (1 / 2)) + 1
su = [True] * k
T_primes = []
for i in range(2, k):
	if su[i]:
		for j in range(i * i, k, i):
			su[j] = False
for x in line:
	if x ** (1 / 2) % 1 == 0 and x != 1:
		if su[int(x ** (1 / 2))]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import ceil, sqrt
INF = 1000001

def sieve():
	primes = [True for i in range(INF)]
	primes[1] = False
	p = 2
	while p * p <= INF:
		if primes[p]:
			for i in range(p * p, INF, p):
				if primes[i]:
					primes[i] = False
		p += 1
	return primes

def main():
	n = int(input())
	x = [int(i) for i in input().split()]
	primes = sieve()
	for i in x:
		sqr = sqrt(i)
		res = ceil(sqr)
		print('YES' if sqr == res and primes[res] else 'NO')
main()


input()
a = map(int, input().split())
N = 1000001
check = [1] * N
check[0] = check[1] = 0
tPrimeSet = set()
for i in range(N):
	if check[i]:
		for j in range(i + i, N, i):
			check[j] = 0
		tPrimeSet.add(i * i)
for i in a:
	if i in tPrimeSet:
		print('YES')
	else:
		print('NO')


DIM = 10 ** 6 + 1
vals = [True] * (10 ** 6 + 1)
vals[0] = False
vals[1] = False
lista = {}
for i in range(2, DIM):
	if vals[i]:
		for j in range(i * i, DIM, i):
			vals[j] = False
		lista[i * i] = 1
x = int(input())
d = list(map(int, input().split()))
for c in d:
	if c in lista:
		print('YES')
	else:
		print('NO')


import math

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
n = int(input())
lis = [int(x) for x in input().split()]
for i in lis:
	a = int(math.sqrt(i))
	if i > 1:
		if a * a == i and isPrime(a) == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


a = int(input())
b = list(map(int, input().split()))

def iprime(n):
	for i in range(3, int(n ** 0.5) + 2):
		if n % i == 0:
			return False
	return True
for i in range(a):
	x = b[i]
	y = x ** 0.5
	if x == 1:
		print('NO')
	elif y != int(y):
		print('NO')
	elif x != 4 and x % 2 == 0:
		print('NO')
	elif iprime(int(y)):
		print('YES')
	else:
		print('NO')


p = []
for i in range(2, 1000):
	for j in p:
		if i % j == 0:
			break
	else:
		p += [i]
input()
for i in map(int, input().split()):
	(y, t) = (1, int(i ** 0.5))
	if t * t != i or i == 1:
		y = 0
	if y:
		for j in p:
			if t % j == 0 and t != j:
				y = 0
				break
	print(['NO', 'YES'][y])


import math

def eratosthenes(n):
	IsPrime = [True] * (n + 1)
	IsPrime[1] = False
	for i in range(2, int(n ** 0.5) + 1):
		if IsPrime[i]:
			for j in range(i * i, n + 1, i):
				IsPrime[j] = False
	return set([x * x for x in range(2, n + 1) if IsPrime[x]])
input()
li = list(map(int, input().split()))
nl = eratosthenes(1000000)
for i in li:
	print('YES' if i in nl else 'NO')


from math import sqrt
x = int(input())
y = list(map(int, input().strip().split(' ')))
limit = 10 ** 6
arr = [1] * (limit // 2)
pos = lambda i: i // 2 - 1

def prime_generate():
	for i in range(3, int(sqrt(limit)), 2):
		if arr[pos(i)]:
			for ii in range(i ** 2, limit, i * 2):
				arr[pos(ii)] = 0

def prime_check(n):
	if n == 1:
		return False
	if n == 2:
		return True
	if n % 2 == 0:
		return False
	return arr[pos(n)]
perfect_root_check = lambda i: int(sqrt(i)) ** 2 == i
prime_generate()
for i in y:
	if i == 4:
		print('YES')
	elif perfect_root_check(i) and prime_check(int(sqrt(i))):
		print('YES')
	else:
		print('NO')


import math
prime = [2, 3, 5]
for i in range(7, 1011):
	s = math.sqrt(i)
	for j in prime:
		if i % j == 0 and i != j:
			break
		elif j > s:
			list.append(prime, i)
			break
n = int(input())
arr = str(input()).split()
for i in range(n):
	s = int(arr[i])
	ss = math.sqrt(s)
	if s == 1:
		print('NO')
	elif int(ss) != ss:
		print('NO')
	else:
		ss = int(ss)
		for j in prime:
			if ss % j == 0 and ss != j:
				print('NO')
				break
			elif j > math.sqrt(ss):
				print('YES')
				break


import sys
from random import choice, randint

def LI():
	return list(map(int, sys.stdin.readline().strip().split()))

def I():
	return int(sys.stdin.readline().strip())

def pf(s):
	return print(s, flush=True)
inp = sys.stdin.readline
out = sys.stdout.write

def main():
	n = I()
	a = LI()

	def seive(n, prime):
		p = 2
		while p ** 2 <= n:
			if prime[p]:
				for i in range(p * 2, n + 1, p):
					prime[i] = False
			p += 1
	prime = [True] * (10 ** 6 + 1)
	seive(10 ** 6, prime)
	for i in a:
		x = int(i ** 0.5)
		if i < 4:
			pf('NO')
		elif x * x != i:
			pf('NO')
		elif prime[x]:
			pf('YES')
		else:
			pf('NO')
main()


import math
a = [1] * (10 ** 6 + 1)
a[0] = a[1] = 0
for i in range(2, 1001):
	if a[i] == 1:
		for j in range(i * i, 10 ** 6 + 1, i):
			a[j] = 0
n = int(input())
l = list(map(int, input().split()))
for i in l:
	p = int(math.sqrt(i))
	if p * p == i and a[p] == 1:
		print('YES')
	else:
		print('NO')


import math
prime = [1] * 1000000
prime[0] = 0
prime[1] = 0
for i in range(2, 1000000):
	if prime[i] == 1:
		for j in range(i * i, 1000000, i):
			prime[j] = 0
n = int(input())
arr = list(map(int, input().split()))
s = set({})
for i in range(1000000):
	if prime[i] == 1:
		s.add(i * i)
for x in arr:
	if x in s:
		print('YES')
	else:
		print('NO')


_ = input()
x = map(int, input().split())
limit = int(1000000000000 ** 0.5) + 1
table = [False] * 2 + [True] * limit
for i in range(2, limit):
	if table[i]:
		for j in range(i ** 2, limit, i):
			table[j] = False
for num in x:
	sqrt = int(num ** 0.5)
	print('YES' if table[sqrt] and sqrt ** 2 == num else 'NO')


import math

def sieve():
	n = 10 ** 6
	prime = [True for _ in range(n + 1)]
	prime[0] = False
	prime[0] = False
	for i in range(2, int(math.sqrt(n)) + 1):
		if prime[i] == True:
			for j in range(i * i, n + 1, i):
				prime[j] = False
	return prime

def solve(val):
	if val == 1:
		return False
	elif val < 4 and n % 2 == 0:
		return False
	elif val == 4:
		return True
	else:
		sq = math.sqrt(val)
		if sq == int(sq):
			if prime[int(sq)] == True:
				return True
		return False
prime = sieve()
n = int(input())
arr = map(int, input().split(' '))
for i in arr:
	if solve(i) == True:
		print('YES')
	else:
		print('NO')


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
n = iinput()
A = rlinput()
import math
limit = 10 ** 6
isprimes = [True] * (limit + 1)
isprimes[0] = False
isprimes[1] = False
p = 2
while p * p <= limit:
	if isprimes[p]:
		for i in range(p * p, limit + 1, p):
			isprimes[i] = False
	p += 1
for a in A:
	cur = math.sqrt(a)
	if cur.is_integer():
		cur = int(cur)
		if isprimes[cur]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
lis = [int(_) for _ in input().split()]
for x in lis:
	if x < 4:
		print('NO')
	else:
		rt = int(x ** 0.5 + 0.5)
		if rt ** 2 != x:
			print('NO')
		else:
			for fac in range(2, int(rt ** 0.5) + 1):
				if rt % fac == 0:
					print('NO')
					break
			else:
				print('YES')


import math
size = int(input())
nums = list(map(int, input().split()))
lim = 10 ** 6
ar = [1] * (lim + 1)
r = {4}
for i in range(2, lim):
	if ar[i] == 1:
		r.add(i * i)
		for j in range(i * i, lim, i):
			ar[j] = 0
for num in nums:
	if num in r:
		print('YES')
	else:
		print('NO')


from sys import *
from math import *
from bisect import *
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
for i in range(n):
	if a[i] == 1:
		print('NO')
	else:
		x = int(sqrt(a[i]))
		if x * x == a[i]:
			f = 0
			for j in range(2, int(sqrt(x)) + 1):
				if x % j == 0:
					f = 1
					break
			if f == 1:
				print('NO')
			else:
				print('YES')
		else:
			print('NO')


from collections import defaultdict
from time import time

def main():
	length = 10 ** 6
	isPrime = [True] * length
	isPrime[0] = isPrime[1] = False
	primeSqList = defaultdict(str)
	for i in range(2, 10 ** 6):
		if isPrime[i]:
			primeSqList[str(i * i)] = 1
			for k in range(2 * i, 10 ** 6, i):
				isPrime[k] = False
	n = int(input())
	arr = list(input().split())
	for i in arr:
		if i in primeSqList:
			print('YES')
		else:
			print('NO')
main()


import datetime
import math

def clock():
	print(datetime.datetime.now())
input()
l = 1000002
c = [1, 1] + [0] * l
for i in range(2, l):
	if 1 - c[i]:
		for j in range(i * i, l, i):
			c[j] = 1
for i in input().split():
	i = int(i)
	r = int(i ** 0.5)
	print('YNEOS'[c[r] or r * r != i::2])


def sieve(n):
	is_prime = [True for i in range(n)]
	is_prime[0] = is_prime[1] = False
	primes = []
	for i in range(2, n):
		if not is_prime[i]:
			continue
		primes.append(i)
		j = i ** 2
		while j < n:
			is_prime[j] = False
			j += i
	return primes
primes = sieve(10 ** 6)
e_nums = {i ** 2 for i in primes}
n = int(input())
tests = input().split()
for i in range(len(tests)):
	tests[i] = int(tests[i])
for test in tests:
	if test in e_nums:
		print('YES')
	else:
		print('NO')


import math
n = 10 ** 6 + 1
prime = [True for i in range(n)]
p = 2
while p * p <= n:
	if prime[p] == True:
		for i in range(p * p, n, p):
			prime[i] = False
	p += 1
prime[1] = False
n = int(input())
l = list(map(int, input().split()))
for i in l:
	x = int(math.sqrt(i))
	if x * x == i and prime[x]:
		print('YES')
	else:
		print('NO')


import math
primes = set()

def sieve():
	l = [True for i in range(10 ** 6 + 1)]
	i = 2
	while i * i <= 10 ** 12:
		if l[i] == True:
			for j in range(2 * i, 10 ** 6 + 1, i):
				l[j] = False
			primes.add(int(i))
		i += 1
n = int(input())
sieve()
s = input().split()
for i in s:
	if math.sqrt(int(i)) in primes:
		print('YES')
	else:
		print('NO')


l = [True] * 1000000
for i in range(2, 998):
	if l[i]:
		for j in range(i ** 2, 1000000, i):
			l[j] = False
n = int(input())
m = list(map(int, input().split()))
for j in range(n):
	s = m[j] ** 0.5
	if s % 1 != 0 or s == 1:
		print('NO')
	elif s % 2 == 0:
		if s != 2:
			print('NO')
		else:
			print('YES')
	elif l[int(s)]:
		print('YES')
	else:
		print('NO')


maxi = 1000000
a = [1] * maxi
s = set()
for i in range(2, maxi):
	if a[i]:
		s.add(i * i)
		for j in range(i * i, maxi, i):
			a[j] = 0
input()
for ele in map(int, input().split()):
	print(['NO', 'YES'][ele in s])


from math import sqrt

def soe(n):
	ans = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			ans.append(p)
	return ans
n = int(input())
l = [int(x) for x in input().split()]
ans = soe(1000000)
ans = set(ans)
for i in l:
	if sqrt(i) in ans:
		print('YES')
	else:
		print('NO')


from math import sqrt, ceil

def seive(n):
	l = [True] * (n + 1)
	for i in range(2, ceil(sqrt(n)) + 1):
		if l[i]:
			for j in range(i * i, n + 1, i):
				l[j] = False
	s = set()
	for i in range(2, n + 1):
		if l[i]:
			s.add(i)
	return s

def fun(n, a):
	s = seive(10 ** 6)
	l = []
	for i in a:
		if sqrt(i) * sqrt(i) == i and sqrt(i) in s:
			l.append('YES')
		else:
			l.append('NO')
	return l

def main():
	n = int(input())
	a = list(map(int, input().split()))
	print(*fun(n, a), sep='\n')
import threading, sys
max_recur_size = 10 ** 4 * 2 + 1000
max_stack_size = max_recur_size * 500
sys.setrecursionlimit(max_recur_size)
threading.stack_size(max_stack_size)
thread = threading.Thread(target=main)
thread.start()


primes = [2, 3, 5, 7, 11, 13, 17]
int(input())
x = list(map(int, input().split()))
for i in x:
	t = i ** 0.5
	if t == int(t) and i != 1:
		t = int(t)
		for j in primes:
			if t == j:
				print('YES')
				break
			elif t % j == 0:
				print('NO')
				break
		else:
			for j in range(primes[-1] + 1, int(t ** 0.5) + 1):
				for k in primes:
					if j % k == 0:
						break
				else:
					primes.append(j)
					if t % j == 0:
						print('NO')
						break
			else:
				print('YES')
	else:
		print('NO')


n = 2 ** 20
a = [1] * n
square = {4}
for i in range(2, n):
	if a[i]:
		for j in range(i * i, n, i):
			a[j] = 0
		square.add(i * i)
input()
for num in map(int, input().split()):
	print(['NO', 'YES'][num in square])


import math

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
n = int(input())
list1 = list(map(int, input().split()))
for i in list1:
	p = math.sqrt(i)
	if p.is_integer() and isPrime(int(p)):
		print('YES')
	else:
		print('NO')


import sys
from random import choice, randint

def MI():
	return map(int, sys.stdin.readline().strip().split())

def LI():
	return list(map(int, sys.stdin.readline().strip().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().strip().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().strip().split()]

def LS():
	return sys.stdin.readline().strip().split()

def I():
	return int(sys.stdin.readline().strip())

def F():
	return float(sys.stdin.readline().strip())

def S():
	return sys.stdin.readline().strip()

def pf(s):
	return sys.stdout.write(s + '\n')

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))
inp = sys.stdin.readline
out = sys.stdout.write

def main():
	n = I()
	a = LI()

	def seive(n, prime):
		p = 2
		while p ** 2 <= n:
			if prime[p]:
				for i in range(p * 2, n + 1, p):
					prime[i] = False
			p += 1
	prime = [True] * (10 ** 6 + 1)
	seive(10 ** 6, prime)
	for i in a:
		x = int(i ** 0.5)
		if i < 4:
			pf('NO')
		elif x * x != i:
			pf('NO')
		elif prime[x]:
			pf('YES')
		else:
			pf('NO')
main()


from math import sqrt, floor
from itertools import count, islice
maxV = 2 ** 20
n = int(input())
buffer = {4}
bufferNotPrime = [True] * maxV
nums = list(map(int, input().split()))
for i in range(2, maxV):
	if bufferNotPrime[i]:
		for j in range(i * i, maxV, i):
			bufferNotPrime[j] = False
		buffer.add(i * i)
for i in nums:
	if i in buffer:
		print('YES')
	else:
		print('NO')


limit = 1000000
primes = []

def isprime_upto():
	isprime = [True] * limit
	isprime[0] = isprime[1] = False
	for i in range(2, limit):
		if isprime[i] == True:
			for j in range(i * i, limit, i):
				isprime[j] = False
	return isprime

def check(n):
	if n == 4:
		return 1
	if n == 1 or n % 2 == 0:
		return 0
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if primes[int(sqrt_n)] == True:
			return 1
	return 0
primes = list(isprime_upto())
cas = int(input())
ar = list(map(int, input().split()))
for i in ar:
	x = check(i)
	if x == 1:
		print('YES')
	else:
		print('NO')


from math import sqrt

def isprime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, int(sqrt(n)) + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	else:
		return True
n = int(input())
arr = [int(i) for i in input().split()]
for i in arr:
	a = int(sqrt(i))
	if a * a == i and isprime(a):
		print('YES')
	else:
		print('NO')


from math import sqrt
n = int(input())
l = list(map(int, input().split()))
o = [True] * 1000009
o[0] = o[1] = False
for i in range(2, len(o)):
	if o[i] == True:
		for j in range(i * i, len(o), i):
			o[j] = False
for i in l:
	if sqrt(i) == int(sqrt(i)):
		if o[int(sqrt(i))] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
l = list(map(int, input().split(' ')))
s = 10 ** 6
a = [True for x in range(s + 1)]
(a[0], a[1]) = (False, False)
y = 2
while y * y <= s:
	if a[y] == True:
		for i in range(y * y, s + 1, y):
			a[i] = False
	y += 1
for i in l:
	q = math.floor(math.sqrt(i))
	if a[q] == False:
		print('NO')
	elif q * q == i:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
x = [int(x) for x in input().split()]

def prime(num):
	if num > 1:
		for i in range(2, int(math.sqrt(num)) + 1):
			if num % i == 0:
				return 0
				break
		return 1
for i in range(len(x)):
	if math.sqrt(x[i]) - int(math.sqrt(x[i])) != 0:
		print('NO')
	elif prime(int(math.sqrt(x[i]))) == 1:
		print('YES')
	else:
		print('NO')


def prime():
	prime = [1] * 1000001
	prime[0] = prime[1] = 0
	for i in range(2, 1001):
		if prime[i] == 1:
			for c in range(i * i, 1000001, i):
				prime[c] = 0
	return prime

def root(num):
	root = int(num ** 0.5) - 1
	if root * root == num:
		return root
	root += 1
	if root * root == num:
		return root
	root += 1
	if root * root == num:
		return root
	return -1
n = int(input())
nums = list(map(int, input().split()))
primes = prime()
for e in range(len(nums)):
	croot = root(nums[e])
	if croot != -1 and primes[croot]:
		print('YES')
	else:
		print('NO')


from bisect import bisect_left

def main():
	input()
	tt = [4]
	limit = 1000004
	lim2 = limit // 2 - 1
	sieve = [True] * lim2
	for i in range(lim2 // 3 + 1):
		if sieve[i]:
			(p, pp) = (2 * i + 3, (i + 3) * i * 2 + 3)
			sieve[pp::p] = [False for _ in range(pp, lim2, p)]
	for (i, f) in enumerate(sieve):
		if f:
			i += i + 3
			tt.append(i * i)
	for x in map(int, input().split()):
		print(('NO', 'YES')[tt[bisect_left(tt, x)] == x])
main()


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def square(n):
	temp = int(math.sqrt(n))
	return temp ** 2 == n

def prime(n):
	if n < 2:
		return 0
	if n == 2:
		return 1
	if n % 2 == 0:
		return 0
	l = int(math.sqrt(n + 1))
	for i in range(3, l + 1, 2):
		if n % i == 0:
			return 0
	return 1
n = inp()
ara = inlt()
for i in range(n):
	temp = ara[i]
	l = int(math.sqrt(temp))
	if prime(l) and square(temp):
		print('YES')
	else:
		print('NO')


import math

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
n = int(input())
l1 = list(map(int, input().split()))
for j in l1:
	sr = math.sqrt(j)
	if sr - math.floor(sr) == 0:
		if isPrime(int(sr)):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import *
n = int(input())
a = [int(x) for x in input().split()]
lim = 1000000
prime = [True for i in range(lim + 1)]
p = 2
while p * p <= lim:
	if prime[p] == True:
		for i in range(p * 2, lim + 1, p):
			prime[i] = False
	p += 1
prime[0] = False
prime[1] = False
for i in range(n):
	if sqrt(a[i]).is_integer():
		if prime[int(sqrt(a[i]))] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


l = [True] * 1000001
l[0] = l[1] = False
for i in range(1001):
	if l[i] == True:
		for j in range(2 * i, 1000001, i):
			l[j] = False
n = int(input())
k = [int(x) for x in input().split()]
for i in range(n):
	print('YES' if int(k[i] ** 0.5) == k[i] ** 0.5 and l[int(k[i] ** 0.5)] == True else 'NO')


import math
n = int(input())
xlist = list(map(int, input().split()))
Tprimes = set()
primes = [1] * 10 ** 6
for i in range(2, 10 ** 6):
	if primes[i]:
		Tprimes.add(i * i)
		primes[i * i::i] = [0] * len(primes[i * i::i])
for x in xlist:
	print('YES' if x in Tprimes else 'NO')


import math

def SieveOfEratosthenes(n, prime):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
s = [True] * (10 ** 6 + 1)
SieveOfEratosthenes(10 ** 6, s)
s[1] = False
n = int(input())
m = [int(i) for i in input().split()]
for i in range(len(m)):
	if s[int(m[i] ** 0.5)] == True and int(m[i] ** 0.5) == math.ceil(m[i] ** 0.5):
		print('YES')
	else:
		print('NO')


n = 2 ** 20
a = [1] * n
s = {4}
for i in range(2, n):
	if a[i]:
		for j in range(i * i, n, i):
			a[j] = 0
		s.add(i * i)
i = input()
l = list(map(int, input().split()))
for x in l:
	if x in s:
		print('YES')
	else:
		print('NO')


from math import sqrt

def er(r):
	a = [True] * (1 + r)
	a[0] = False
	p = []
	for i in range(2, r + 1):
		if a[i]:
			p.append(i)
			for j in range(i * i, r + 1, i):
				a[j] = False
	return p

def is_prime(a):
	if a < 2:
		return False
	elif a == 2:
		return True
	elif a % 2 == 0:
		return False
	else:
		for i in range(3, 1 + int(a ** 0.5), 2):
			if a % i == 0:
				return False
	return True
n = int(input())
a = list(map(int, input().split()))
for i in a:
	c = int(sqrt(i))
	if c ** 2 == i and is_prime(c):
		print('YES')
	else:
		print('NO')


input()
a = list(map(int, input().split()))
N = round(max(a) ** 0.5) + 1
sieve = [0] + [1] * (N // 2 + 1)
res = {4}
for j in range(1, N // 2 + 1):
	if sieve[j]:
		p = 2 * j + 1
		res.add(p * p)
		for i in range(p * p, N, 2 * p):
			sieve[i // 2] = 0
for v in a:
	print(['NO', 'YES'][v in res])


import sys
from random import choice, randint
inp = sys.stdin.readline
out = sys.stdout.write
flsh = sys.stdout.flush
sys.setrecursionlimit(10 ** 9)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def MI():
	return map(int, inp().strip().split())

def LI():
	return list(map(int, inp().strip().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in inp().strip().split()]

def LF():
	return [float(x) for x in inp().strip().split()]

def LS():
	return inp().strip().split()

def I():
	return int(inp().strip())

def F():
	return float(inp().strip())

def S():
	return inp().strip()

def pf(s):
	return out(s + '\n')

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	n = I()
	a = LI()
	l = []

	def seive(n, prime):
		p = 2
		while p ** 2 <= n:
			if prime[p]:
				for i in range(p * 2, n + 1, p):
					prime[i] = False
			p += 1
	prime = [True] * (10 ** 6 + 1)
	seive(10 ** 6, prime)
	for i in a:
		x = int(i ** 0.5)
		if i < 4:
			l.append('NO')
		elif x * x != i:
			l.append('NO')
		elif prime[x]:
			l.append('YES')
		else:
			l.append('NO')
	for i in l:
		pf(i)
main()


def istprime(n):
	if n == 1:
		return 'NO'
	else:
		x = n ** 0.5
		if int(x) != x:
			return 'NO'
		else:
			z = int(x)
			if z % 2 == 0:
				if z == 2:
					return 'YES'
				else:
					return 'NO'
			else:
				for i in range(3, int(z ** 0.5) + 1, 2):
					if z % i == 0:
						return 'NO'
				return 'YES'
t = int(input())
L = list(map(int, input().split()))
for i in range(0, t):
	print(istprime(L[i]))


def eratosthenes(n):
	lis = [0 for i in range(n + 1)]
	lis2 = []
	for i in range(2, n + 1):
		if lis[i] == 0:
			lis2.append(i)
			for j in range(i * 2, n + 1):
				if j % i == 0:
					lis[j] = 1
	return lis2
p = eratosthenes(1000)
import math
n = int(input())
lis = [int(x) for x in input().split()]
for i in range(0, n):
	w = int(math.sqrt(lis[i]))
	if w ** 2 != lis[i] or w == 1:
		print('NO')
	elif w in p:
		print('YES')
	else:
		for k in p:
			if w % k == 0:
				print('NO')
				break
		else:
			print('YES')


import math
n = int(input())
a = input().split()
primes = [2]
for k in range(3, 2000):
	for i in primes:
		flag = True
		if k % i == 0:
			flag = False
			break
	if flag:
		primes.append(k)
for i in range(n):
	b = int(math.sqrt(int(a[i])))
	if not b * b == int(a[i]):
		print('NO')
	else:
		done = False
		for k in primes:
			if b > k and b % k == 0:
				print('NO')
				done = True
				break
		if not done:
			c = int(math.sqrt(b))
			flag = False
			for j in range(2, c + 1):
				if b % j == 0:
					flag = True
					break
			if flag or b == 1:
				print('NO')
			else:
				print('YES')


primes = []

def generate_primes(LIMIT):
	global primes
	primes = [True] * LIMIT
	(primes[0], primes[1]) = (False, False)
	for i in range(2, LIMIT):
		if primes[i]:
			for j in range(i * i, LIMIT, i):
				primes[j] = False

def is_perfect_square(number):
	sqr = number ** 0.5
	return sqr == int(sqr)

def is_t_prime(numbers):
	for number in numbers:
		if number % 2 == 0:
			if number != 4:
				print('NO')
			else:
				print('YES')
		elif is_perfect_square(number) and primes[int(number ** 0.5)]:
			print('YES')
		else:
			print('NO')

def main():
	generate_primes(1000000)
	n = int(input())
	numbers = list(map(int, input().split()))
	is_t_prime(numbers)
main()


import math as mt
MAXN = 1000001
spf = [0 for i in range(MAXN)]

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret
n = int(input())
x = [int(a) for a in input().split()]
sieve()
for e in x:
	c = e ** 0.5
	if c % 1 == 0:
		iri = getFactorization(int(c))
		if len(iri) == 1 and iri[0] % 1 == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


prime = [True] * 1000001

def sq_root(x):
	root = int(x ** 0.5) - 1
	if root * root == x:
		return root
	root += 1
	if root * root == x:
		return root
	root += 1
	if root * root == x:
		return root
	return -1
prime[0] = False
prime[1] = False
for i in range(2, 1001):
	if prime[i]:
		for j in range(i * i, 1000001, i):
			prime[j] = False
n = int(input())
numbers = list(map(int, input().split()))
for e in numbers:
	root = sq_root(e)
	if root != -1 and prime[root]:
		print('YES')
	else:
		print('NO')


prime = [True] * (10 ** 6 + 1)
b = set()
for i in range(2, 10 ** 6 + 1):
	if prime[i] == True:
		b.add(i ** 2)
		for j in range(2 * i, 10 ** 6 + 1, i):
			prime[j] = False
n = int(input())
z = list(map(int, input().split()))
for i in z:
	if i in b:
		print('YES')
	else:
		print('NO')


seive = [1] * 1000000
square = set()
for i in range(2, 1000000):
	if seive[i] == 1:
		square.add(i * i)
		for j in range(i * i, 1000000, i):
			seive[j] = 0
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if a[i] not in square:
		print('NO')
	else:
		print('YES')


def is_prime(n: int) -> bool:
	if n == 2 or n == 3:
		return True
	elif n % 2 == 0 or n < 2:
		return False
	elif n < 9:
		return True
	elif n % 3 == 0:
		return False
	for i in range(5, int(n ** 0.5) + 1, 6):
		if n % i == 0:
			return False
		if n % (i + 2) == 0:
			return False
	return True
input()
x = [int(i) ** 0.5 for i in input().split()]
for i in x:
	print(['NO', ['NO', 'YES'][is_prime(int(i))]][i % 1 == 0])


n = int(input())

def prime(x):
	if x > 1:
		for i in range(2, int(x ** 0.5) + 1):
			if x % i == 0:
				return False
				break
		else:
			return True
	return False
s = [int(x) for x in input().split()]
for i in range(n):
	r = s[i] ** 0.5
	if r == int(r):
		if prime(int(r)) == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


isPrime = [False] + [True] * 1000002
for i in range(2, 1000002):
	if isPrime[i]:
		for j in range(i * i, 1000002, i):
			isPrime[j] = False
(_, b, isPrime[1], isPrime[1000000]) = (input(), [int(x) for x in input().split()], False, False)
for row in b:
	print('NYOE S'[isPrime[int(row ** 0.5)] and row ** 0.5 == int(row ** 0.5)::2])


import math

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True
n = int(input())
x = list(map(int, input().split()))
for i in range(n):
	t = int(math.sqrt(x[i]))
	if prime(t) and t * t == x[i]:
		print('YES')
	else:
		print('NO')


from time import time
from math import sqrt

def primes(n):
	sieve = set(range(3, n + 1, 2))
	if n >= 2:
		sieve.add(2)
	for i in range(3, int(n ** 0.5) + 1, 2):
		if i in sieve:
			sieve -= set(range(2 * i, n + 1, i))
	return sieve
t = time()
n = input()
a = []
for el in map(int, input().split()):
	sqrt_a = int(sqrt(el))
	a.append(sqrt_a if sqrt_a ** 2 == el else 1)
primes_a = primes(max(a))
print('\n'.join(('YES' if el in primes_a else 'NO' for el in a)))


prime = [True for i in range(1000001 + 1)]

def SieveOfEratosthenes(n):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
import math
n = int(input())
T = [int(x) for x in input().split()]
SieveOfEratosthenes(1000001)
for i in T:
	temp = math.sqrt(i)
	if i == 1:
		print('NO')
	elif temp - int(temp) == 0:
		if prime[int(temp)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def bs(a, l, h, x):
	while l < h:
		print(l, h)
		mid = (l + h) // 2
		if a[mid] == x:
			return mid
		if a[mid] < x:
			l = mid + 1
		else:
			h = mid
	return l

def sieve(a):
	for i in range(3, 10 ** 6 + 1, 2):
		a[i] = 1
	for i in range(3, 10 ** 6 + 1, 2):
		for j in range(i * i, 10 ** 6 + 1, i):
			a[j] = 0
	a[2] = 1
	return a

def solve():
	n = int(inp())
	a = lis()
	s = [0] * (10 ** 6 + 1)
	s = sieve(s)
	for i in range(0, n):
		if floor(a[i] ** 0.5) == a[i] ** 0.5:
			chck = int(a[i] ** 0.5)
			if s[chck] == 1:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
testcase(1)


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}
from math import floor
from bisect import bisect_left

def smaller(lst, x):
	return bisect_left(lst, x)

def primeGen(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	ans = []
	for p in range(2, n + 1):
		if prime[p]:
			ans.append(p)
	return ans
prime = primeGen(1000000)

def solve(i):
	if i == floor(i ** 0.5) ** 2:
		val = floor(i ** 0.5)
		ind = smaller(prime, val)
		if ind != len(prime) and prime[ind] == val:
			return 'YES'
		return 'NO'
	else:
		return 'NO'
	if tprime.get(i) == None:
		return 'NO'
	return 'YES'
n = int(input())
lst = list(map(int, input().split()))
for i in lst:
	print(solve(i))


def prime_flag():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	return li
import math
n = int(input())
li = [int(x) for x in input().split()]
prime_flag = prime_flag()
for ele in li:
	x = math.sqrt(ele)
	y = int(x)
	if x == y:
		if prime_flag[y] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
v = list(map(int, input().strip().split()))
M = int(math.sqrt(max(v))) + 1
prime = [True] * M
prime[1] = False
prime[0] = True
x = 1
for i in range(2, M):
	if prime[i]:
		for j in range(i * i, M, i):
			prime[j] = False
for i in v:
	val = math.sqrt(i)
	if val.is_integer():
		val = int(val)
		if prime[val]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt
n = int(input())
l = [int(j) for j in input().split()]
big = int(1000000.0 + 2)
pr = [True for i in range(big)]
for i in range(2, big):
	if pr[i] == True:
		for j in range(i ** 2, big, i):
			pr[j] = False
pr[1] = False
pr[0] = False
for i in range(n):
	m = sqrt(l[i])
	if m == int(m):
		if pr[int(m)] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
l = list(map(int, input().split()))

def prime(p):
	if p == 1:
		return 0
	for k in range(2, int(math.sqrt(p) + 1)):
		if p % k == 0:
			return 0
	return 1
for x in l:
	if int(math.sqrt(x)) * int(math.sqrt(x)) == x and prime(int(math.sqrt(x))) == 1:
		print('YES')
	else:
		print('NO')


import math
s = int(input())
k = [int(x) for x in input().split()]
n = 1000000
isprime = [True] * (n + 1)
isprime[1] = False
for i in range(2, n):
	if isprime[i]:
		for j in list(range(i + i, n + 1, i)):
			isprime[j] = False
for i in range(s):
	u = int(math.sqrt(k[i]))
	ok = 0
	if k[i] == u * u and isprime[u]:
		ok = 1
	if ok:
		print('YES')
	else:
		print('NO')


import math
t_list = [1] * 1000001
t_list[0] = 0
t_list[1] = 0
for i in range(2, 1000):
	if t_list[i] == 0:
		continue
	j = i * i
	while j <= 1000000:
		t_list[j] = 0
		j += i
input_s = input()
input_l = map(int, input().split())
for i in input_l:
	m = int(math.sqrt(i))
	print('YES' if m * m == i and t_list[m] == 1 else 'NO')


from sys import stdin, stdout, maxsize
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
stpr = lambda x: stdout.write(f'{x}' + '\n')
N = int(1000000.0) + 1
a = [1] * N
d = {}
for i in range(2, N):
	if a[i]:
		for j in range(i * i, N, i):
			a[j] = 0
		d[i * i] = True
I()
for i in lint():
	try:
		if d[i] == True:
			stpr('YES')
	except KeyError:
		stpr('NO')


def Sieve(n):
	if n < 2:
		return 'NO'
	else:
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				return 'NO'
		return 'YES'

def main():
	n = int(input())
	p1 = list(map(int, input().split()))
	for i in range(len(p1)):
		if p1[i] ** 0.5 == int(p1[i] ** 0.5):
			ans = Sieve(int(p1[i] ** 0.5))
			print(ans)
		else:
			print('NO')
main()


from math import sqrt
primes = [1] * 1000000
sq = set()
for i in range(2, len(primes)):
	if primes[i]:
		sq.add(i * i)
		for j in range(i * i, len(primes), i):
			primes[j] = 0
input()
lst = list(map(int, input().split()))
for i in lst:
	if i in sq:
		print('YES')
	else:
		print('NO')


from sys import stdin
from math import sqrt
inp = lambda : stdin.readline().strip()
t = int(inp())

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
x = SieveOfEratosthenes(1000000)
a = [int(x) for x in inp().split()]
for i in a:
	if sqrt(i).is_integer() and x[int(sqrt(i))] == 1 and (i != 1):
		print('YES')
	else:
		print('NO')


n = int(input())
numbers = [int(x) for x in input().split()]
s = [True] * 1000001
p = 2
while p * p <= 1000001:
	if s[p]:
		for i in range(p * 2, 1000001, p):
			s[i] = False
	p += 1
for v in numbers:
	if v < 4:
		print('NO')
		continue
	elif v ** 0.5 % 1 != 0:
		print('NO')
		continue
	if s[int(v ** 0.5)]:
		print('YES')
	else:
		print('NO')


S = [1] * 1000010
(S[0], S[1]) = (0, 0)
for i in range(2, 1000):
	if S[i] == 1:
		j = i * i
		while j <= 1000000:
			S[j] = 0
			j += i
n = int(input())
SS = [int(x) for x in input().split()]
for i in range(n):
	x = int(SS[i] ** 0.5)
	if S[x] == 1 and x * x == SS[i]:
		print('YES')
	else:
		print('NO')


prime = [True] * 1000001
t_primes = set()
prime[0] = prime[1] = False
for i in range(2, 1000001):
	if prime[i]:
		t_primes.add(i ** 2)
		for j in range(i ** 2, 1000001, i):
			prime[j] = False
n = int(input())
numbers = input().split()
for number in numbers:
	if int(number) in t_primes:
		print('YES')
	else:
		print('NO')


n = int(1000000.0)
s = set()
primes = [1] * n
primes[0] = 0
primes[1] = 0
for i in range(2, n):
	if primes[i]:
		s.add(i ** 2)
		for j in range(i ** 2, n, i):
			primes[j] = 0
ninp = input()
my_list = list(map(int, input().split()))
for x in my_list:
	print('YES' if x in s else 'NO')


import sys
import math
n = int(input())
l = list(map(int, input().split()))
n = 10 ** 6 + 1
mark = [1] * n
mark[1] = 0
for i in range(2, n):
	if mark[i] == 1:
		for j in range(i * i, n, i):
			mark[j] = 0
for i in l:
	x = int(i ** 0.5)
	if mark[x] == 0 or x * x != i:
		print('NO')
	else:
		print('YES')


def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
t = int(input())
n = list(map(int, input().split()))
mxx = max(n)
mx = int(mxx ** 0.5) + 1
primes = SieveOfEratosthenes(mx)
for i in range(len(n)):
	if n[i] <= 1:
		print('NO')
	else:
		l = int(n[i] ** 0.5)
		if l ** 2 == n[i]:
			if primes[l] == True:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


import math

def SieveOfEratosthenes(n, a):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			a.append(p)
	return a

def squarePrime(a):
	b = {}
	for i in range(len(a)):
		b[a[i] * a[i]] = 1
	return b
n = int(input())
a = list(map(int, input().split()))
ans = SieveOfEratosthenes(1000000, [])
b = squarePrime(ans)
for i in range(len(a)):
	if b.get(a[i], 0) > 0:
		print('YES')
	else:
		print('NO')


prime = [True for i in range(10 ** 6 + 10)]
dragon = {}

def SOE():
	p = 2
	n = 10 ** 6 + 10
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n, p):
				prime[i] = False
		p += 1
SOE()
n = 10 ** 6 + 10
for i in range(2, n):
	if prime[i]:
		dragon[i * i] = 1
n = int(input())
l = list(map(int, input().split()))
for i in l:
	try:
		if dragon[i] == 1:
			print('YES')
	except:
		print('NO')


import math
n = int(input())
l = list(map(int, input().split()))
sieve = [True for j in range(int(1000000.0 + 2))]
for j in range(2, len(sieve)):
	if sieve[j]:
		for k in range(j * j, len(sieve), j):
			sieve[k] = False
for j in range(n):
	x = math.sqrt(l[j])
	if x == int(x) and sieve[int(x)] and (x != 1):
		print('YES')
	else:
		print('NO')


import math
n = input()
integers = map(int, input().split())
maximum = 1000000
aux = [True for i in range(maximum + 1)]
results = {}
for i in range(2, maximum):
	if aux[i]:
		results[i * i] = True
		for j in range(i * i, maximum + 1, i):
			aux[j] = False
for integer in integers:
	result = 'YES' if integer in results else 'NO'
	print(result)


def sieve(n):
	arr = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n):
		if prime[p]:
			arr.append(float(p))
	return arr
n = 10 ** 6
a = [1] * n
r = {4}
for i in range(2, n):
	if a[i]:
		r.add(i ** 2)
		for j in range(i ** 2, n, i):
			a[j] = 0
k = int(input())
numbers = list(map(int, input().split()))
for d in numbers:
	print(['NO', 'YES'][d in r])


def calcraiz(x):
	raiz = int(x ** 0.5) - 1
	if raiz * raiz == x:
		return raiz
	raiz += 1
	if raiz * raiz == x:
		return raiz
	raiz += 1
	if raiz * raiz == x:
		return raiz
	return -1
primos = [1] * 1000001
primos[0] = 0
primos[1] = 0
for i in range(2, 1001):
	if primos[i] == 1:
		for j in range(i * i, 1000001, i):
			primos[j] = 0
saida = []
n = int(input())
entrada = input().split()
for k in entrada:
	raiz = calcraiz(int(k))
	if raiz != -1 and primos[raiz] == 1:
		saida.append('YES')
	else:
		saida.append('NO')
for l in saida:
	print(l)


from math import sqrt
limit = pow(10, 6) + 1

def getFlags():
	flags = [True] * limit
	flags[0] = flags[1] = False
	for i in range(2, limit):
		if flags[i]:
			for j in range(i * i, limit, i):
				flags[j] = False
	return flags
flags = getFlags()
n = int(input())
vals = [int(x) for x in input().split()]
for val in vals:
	sq = int(sqrt(val))
	if val == sq * sq and flags[sq]:
		print('YES')
	else:
		print('NO')


def sieve(b):
	a = [0] * (b + 1)
	p = []
	for i in range(2, b + 1):
		if a[i] == 0:
			p.append(i)
		for j in range(i, b + 1, i):
			a[j] = 1
	return p

def check(t, x):
	if t == 1:
		return 0
	if int(t) - t == 0:
		if binarysearch(x, int(t)) == 1:
			return 1
		else:
			return 0
	else:
		return 0

def binarysearch(x, a):
	i = 0
	l = len(x) - 1
	while i <= l:
		mid = (i + l) // 2
		if x[mid] == a:
			return 1
		elif x[mid] > a:
			l = mid - 1
		else:
			i = mid + 1
	return 0
n = int(input())
a = [float(i) ** 0.5 for i in input().split()]
b = int(max(a))
x = sieve(b)
for i in a:
	p = check(i, x)
	if p == 1:
		print('YES')
	else:
		print('NO')


l = 10 ** 6
bool_list = [1] * l
square_of_primes = {0}
for p in range(2, l):
	if bool_list[p]:
		for j in range(p * p, l, p):
			bool_list[j] = 0
		square_of_primes.add(p * p)
input()
for d in map(int, input().split()):
	if d in square_of_primes:
		print('YES')
	else:
		print('NO')


import math
TC = int(input())
arr = list(map(int, input().split()))
for a in arr:
	square = int(math.sqrt(a))
	if a == 1:
		print('NO')
		continue
	if square * square != a:
		print('NO')
	else:
		i = 2
		able = True
		while i * i <= square:
			if square % i == 0:
				able = False
				break
			i += 1
		if able:
			print('YES')
		else:
			print('NO')


def is_prime(x):
	l = [True] * (int(x) + 1)
	l[0] = l[1] = False
	for p in range(2, int(x)):
		if l[p] == True:
			for _ in range(p * 2, int(x), p):
				l[_] = False
	return l[1:]
tkpl = is_prime(1000000)
n = int(input())
l_new = input().split()
for m in l_new:
	if int(m) == 4:
		print('YES')
	elif int(m) < 4 or int(m) % 2 == 0:
		print('NO')
	else:
		m_sqrt = int(m) ** 0.5
		if m_sqrt % 1 == 0 and tkpl[int(m_sqrt) - 1] == True:
			print('YES')
		else:
			print('NO')


from math import ceil
l = [-1] * 1000001
p = 2
l[1] = 0
while p * p <= 1000000:
	if l[p] == -1:
		for i in range(p * p, 1000000 + 1, p):
			l[i] = 0
	p += 1
n = int(input())
l1 = list(map(int, input().split()))
for i in l1:
	x = pow(i, 0.5)
	if ceil(x) == x:
		if l[int(x)] == -1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def criba(n):
	L = [False, False] + [True] * (n - 1)
	c = set()
	for k in range(2, n + 1):
		if L[k]:
			c.add(k ** 2)
			for j in range(k ** 2, n + 1, k):
				L[j] = False
	return c
input()
A = criba(1000000)
for k in map(int, input().split()):
	if k in A:
		print('YES')
	else:
		print('NO')


import math

def getIn():
	return input().strip()

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	return prime
n = int(getIn())
b = list(map(int, getIn().split(' ')))
prime = SieveOfEratosthenes(int(1000000.0))
for num in b:
	sr = math.sqrt(num)
	fl = math.floor(sr)
	if sr - fl == 0:
		if prime[int(sr)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
prime = []

def isprime2(n):
	prime = [True for i in range(n + 1)]
	lis = []
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	return prime
	for p in range(n + 1):
		if prime[p]:
			lis.append(p)
	return lis
p = isprime2(1000000)
a = int(input())
x = input().split()
count = 0
for l in x:
	f = math.sqrt(int(l))
	if f.is_integer() and p[int(f)] == True:
		print('YES')
	else:
		print('NO')


a = int(input())
b = list(map(int, input().split()))
x = [1] * (10 ** 6 + 1)
x[1] = 0
for i in range(1, 1000001):
	if x[i]:
		if i < 500001:
			for j in range(2 * i, 10 ** 6 + 1, i):
				x[j] = 0
for i in b:
	a = int(i ** 0.5)
	if a ** 2 == i:
		if x[a]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt
n = input()
n = list(map(int, input().split()))
oo = 1000000
p = [1] * (oo + 1)

def getp():
	global p
	p[0] = p[1] = 0
	for n in range(int(sqrt(oo)) + 1):
		if p[n]:
			j = n ** 2
			while 1:
				if j > oo:
					break
				p[j] = 0
				j += n

def issq(n):
	n = sqrt(n)
	if n == int(n):
		return 1
	return 0
getp()
for v in n:
	if issq(v) and p[int(sqrt(v))]:
		print('YES')
	else:
		print('NO')
getp()


a = [1] * (10 ** 6 + 1)
a[0] = a[1] = False
i = 2
while i ** 2 <= 10 ** 6:
	for j in range(i, int(10 ** 6 / i) + 1):
		a[i * j] = False
	for k in range(i, 10 ** 6 + 1):
		if a[k + 1] == 1:
			i = k + 1
			break
n = int(input())
b = [int(x) for x in input().split()]
for i in b:
	j = i ** 0.5
	if j != int(j):
		print('NO')
	elif a[int(j)] == 1:
		print('YES')
	else:
		print('NO')


a = 1000001
d = [1, 1] + [0] * a
for i in range(2, a):
	if 1 - d[i]:
		for j in range(i * i, a, i):
			d[j] = 1
input()
(*l,) = map(int, input().split())
for i in l:
	r = int(i ** 0.5)
	print('YNEOS'[d[r] or r ** 2 != i::2])


def is_prime(n):
	if n % 2 == 0 and n != 2 or n == 1:
		return False
	sqrt_n = int(n ** 0.5) + 1
	for x in range(3, sqrt_n, 2):
		if n % x == 0:
			return False
	return True

def sieve(n):
	prime = [True for i in range(n + 1)]
	prime[0] = False
	prime[1] = False
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
_ = input()
l = map(int, input().split())
s = sieve(10 ** 6)
for n in l:
	if n ** 0.5 == int(n ** 0.5):
		print('YES' if s[int(n ** 0.5)] else 'NO')
	else:
		print('NO')


import sys
input = sys.stdin.readline
caps = 1000009
sieve = [True for _ in range(caps)]
sieve[0] = sieve[1] = False
primes = set()
p = 2
while p * p <= caps:
	if sieve[p] == True:
		for i in range(p * p, caps, p):
			sieve[i] = False
	p += 1
for i in range(caps):
	if sieve[i]:
		primes.add(i)
n = int(input())
array = list(map(int, input().split()))
for i in array:
	this = i ** 0.5
	if this in primes:
		print('YES')
	else:
		print('NO')


n = int(input())
A = [True] * 10 ** 6
d = 2
for d in range(2, 1000):
	if A[d]:
		for i in range(d * d, 10 ** 6, d):
			A[i] = False
primes = set()
for i in range(2, 10 ** 6):
	if A[i]:
		primes.add(i * i)
B = list(map(int, input().split()))
for e in B:
	if e in primes:
		print('YES')
	else:
		print('NO')


import math

def primes_sieve2(limit):
	a = [True] * limit
	a[0] = a[1] = False
	for (i, isprime) in enumerate(a):
		if isprime:
			yield i
			for n in range(i * i, limit, i):
				a[n] = False
num_peop = input()
pri = set(primes_sieve2(10 ** 6))
for x in map(int, input().split(' ')):
	if x == 1:
		print('NO')
	elif x % 2 == 0 and x != 4:
		print('NO')
	else:
		z = math.sqrt(x)
		if not z.is_integer():
			print('NO')
		elif z in pri:
			print('YES')
		else:
			print('NO')


from sys import stdin

def binary_search(data, val):
	highIndex = len(data) - 1
	lowIndex = 0
	while highIndex > lowIndex:
		index = (highIndex + lowIndex) // 2
		sub = data[index]
		if data[lowIndex] == val:
			return [lowIndex, lowIndex]
		elif sub == val:
			return [index, index]
		elif data[highIndex] == val:
			return [highIndex, highIndex]
		elif sub > val:
			if highIndex == index:
				return sorted([highIndex, lowIndex])
			highIndex = index
		else:
			if lowIndex == index:
				return sorted([highIndex, lowIndex])
			lowIndex = index
	return sorted([highIndex, lowIndex])

def SieveOfEratosthenes(n):
	all_prime = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n):
		if prime[p]:
			all_prime.append(p)
	all_prime = [i * i for i in all_prime]
	return all_prime
n = 10 ** 6
r = SieveOfEratosthenes(n)
z = int(input())
l = list(map(int, stdin.readline().rstrip().split(' ')))
for i in l:
	if i >= 4:
		a = binary_search(r, i)
		if a[0] == a[1]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math

def gcd(a):
	if a <= 1:
		return -1
	for i in range(2, int(math.sqrt(a)) + 1):
		if a % i == 0:
			return -1
	return 0
n = int(input())
a = list(map(int, input().split(' ')))
for i in a:
	if i == 1:
		print('NO')
		continue
	dou = math.sqrt(i)
	if dou % 1 == 0:
		dou = int(dou)
		d = gcd(dou)
		if dou == 2:
			print('YES')
		elif d == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
x = list(map(int, input().split()))
primos = [1] * 1000001
(primos[0], primos[1]) = (0, 0)
for i in range(2, 1001):
	if primos[i] == 1:
		for j in range(i * i, 1000001, i):
			if j >= 1000001:
				break
			primos[j] = 0
for i in range(len(x)):
	raiz = math.sqrt(x[i])
	if int(raiz * 1000000) % 1000000 == 0:
		if x[i] == 0 or x[i] == 1:
			print('NO')
		elif primos[int(raiz * 1000000) // 1000000]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def raiz(x):
	raiz = int(x ** 0.5) - 1
	if raiz * raiz == x:
		return raiz
	raiz += 1
	if raiz * raiz == x:
		return raiz
	raiz += 1
	if raiz * raiz == x:
		return raiz
	return -1
primos = [True] * 1000001
primos[0] = primos[1] = False
for i in range(2, 1001):
	if primos[i]:
		for j in range(i * i, 1000001, i):
			primos[j] = False
input()
numeros = list(map(int, input().split()))
for numero in numeros:
	root = raiz(numero)
	if root != -1 and primos[root]:
		print('YES')
	else:
		print('NO')


sieve = [0] * 2 + [1] * 1000001
for i in range(2, 1001):
	if sieve[i]:
		for j in range(i * 2, 1000001, i):
			sieve[j] = 0
n = input()
for i in map(int, input().split()):
	print(['NO', 'YES'][int(i ** 0.5) * int(i ** 0.5) == i and sieve[int(i ** 0.5)]])


limit = 1000000

def genPrime():
	primes = [True] * limit
	primes[0] = primes[1] = False
	for i in range(2, limit):
		if primes[i] == True:
			for j in range(i * i, limit, i):
				primes[j] = False
	return primes

def checkTprime(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrtt = n ** 0.5
	if sqrtt == int(sqrtt):
		if primes[int(sqrtt)]:
			return True
	return False
primes = genPrime()
num = int(input())
l = [int(x) for x in input().split()]
for i in l:
	if checkTprime(i):
		print('YES')
	else:
		print('NO')


import math

def main():
	_ = int(input())
	numbers = [int(i) for i in input().split(' ')]
	for number in numbers:
		if is_t_prime(number):
			print('YES')
		else:
			print('NO')

def is_t_prime(num):
	if num < 4:
		return False
	if num > 4 and num % 2 == 0:
		return False
	sqrt_ = math.sqrt(num)
	if sqrt_ == int(sqrt_):
		if is_prime(int(sqrt_)):
			return True
	return False

def is_prime(num):
	if num <= 1:
		return False
	if num == 2 or num == 3:
		return True
	if num % 2 == 0 or num % 3 == 0:
		return False
	fact = 5
	while fact * fact <= num:
		if num % fact == 0:
			return False
		fact += 2
	return True
main()


import math

def sieve(n):
	isPrime = [True] * n
	isPrime[0] = False
	isPrime[1] = False
	i = 2
	while i * i <= n:
		if isPrime[i]:
			j = i + i
			while j < n:
				isPrime[j] = False
				j += i
		i += 1
	return isPrime

def isTNumber(num, sieve):
	if num < 4:
		return False
	squareroot = math.sqrt(num)
	if squareroot.is_integer():
		return sieve[int(squareroot)]
	return False
n = int(input())
nums = [int(val) for val in input().split()]
sieve = sieve(1000001)
for num in nums:
	print('YES' if isTNumber(num, sieve) else 'NO')


isPrime = [True] * 1000001
isPrime[0] = False
isPrime[1] = False
for i in range(2, 1000001):
	if isPrime[i]:
		for j in range(i + i, 1000001, i):
			isPrime[j] = False
n = int(input())
lst = [int(i) for i in input().split(' ')]
for i in lst:
	x = int(i ** 0.5)
	if x ** 2 == i and isPrime[x]:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
import bisect as bi
import heapq

def I():
	return int(input())

def In():
	return map(int, input().split())

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	ans = {}
	for p in range(n + 1):
		if prime[p]:
			ans[p] = 1
	return ans

def main():
	try:
		n = I()
		d = SieveOfEratosthenes(1000000)
		l = list(In())
		ans = []
		for x in l:
			t = int(x ** 0.5)
			if t ** 2 == x:
				if d.get(t):
					ans.append('YES')
				else:
					ans.append('NO')
			else:
				ans.append('NO')
		for x in ans:
			print(x)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


import math
n = int(input())
numList = list((int(num) for num in input().strip().split()))[:n]
l = []

def sieve():
	for i in range(1000001):
		l.append(True)
	l[0] = False
	l[1] = False
	for x in range(2, 1000001):
		if l[x] == True:
			a = x + x
			b = x
			for z in range(a, 1000001, b):
				l[z] = False
sieve()
for i in range(n):
	sq = int(math.sqrt(numList[i]))
	if sq * sq != numList[i] or numList[i] == 1 or (numList[i] != 4 and numList[i] % 2 == 0):
		print('NO')
	elif sq * sq == numList[i] and l[sq] == True:
		print('YES')
	else:
		print('NO')


input()
n = 10 ** 6 + 1
prime = [0, 0] + [1] * n
for i in range(2, n):
	if prime[i]:
		for j in range(i ** 2, n, i):
			prime[j] = 0
che = list(map(int, input().split()))
for i in range(len(che)):
	if (che[i] ** 0.5).is_integer():
		if prime[int(che[i] ** 0.5)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = 2 ** 20
ar = [1] * n
ar1 = {4}
for i in range(2, n):
	if ar[i]:
		ar[i] = 0
		ar1.add(i * i)
		for i in range(i * i, n, i):
			ar[i] = 0
input()
for j in map(int, input().split()):
	if j in ar1:
		print('YES')
	else:
		print('NO')


import sys
is_prime = [True] * (10 ** 6 + 1)
is_prime[0] = is_prime[1] = False
p = 2
while p * p <= 10 ** 6:
	if is_prime[p]:
		for n in range(p * p, 10 ** 6 + 1, p):
			is_prime[n] = False
	p += 1
n = int(sys.stdin.readline())
arr = [int(x) for x in sys.stdin.readline().split()]
for x in arr:
	d = int(x ** (1 / 2))
	if d * d == x:
		if is_prime[int(d)] is True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt
n = int(input())
s = [int(i) for i in input().split()]
d = [1] * 1000002
e = set()
for i in range(2, 1000002):
	if d[i]:
		e.add(i ** 2)
		for j in range(i ** 2, 1000002, i):
			d[j] = 0
for i in range(n):
	if s[i] in e:
		print('YES')
	else:
		print('NO')


def op(n):
	x = list(range(n + 1))
	x[1] = 0
	for i in x:
		if i > 1:
			for j in range(i + i, len(x), i):
				x[j] = 0
	return x
n = int(input())
c = list(map(int, input().split()))
p = set(op(1000000))
for i in c:
	if i ** 0.5 in p:
		print('YES')
	else:
		print('NO')


import math

def prime(number):
	if number == 1:
		return False
	if number == 2 or number == 3:
		return True
	if number % 2 == 0:
		return False
	i = 2
	while i <= math.sqrt(number):
		if number % i == 0:
			return False
		i += 1
	return True

def factors(number):
	if math.sqrt(number) != int(math.sqrt(number)):
		return False
	temp = int(math.sqrt(number))
	if prime(temp):
		return True
	return False
n = int(input())
arr = list(map(int, input().split()))
for i in range(n):
	if factors(arr[i]):
		print('YES')
	else:
		print('NO')


from bisect import bisect_left
n = int(input())
nums = map(int, input().split())

def get_sieve():
	len_nums = 10 ** 6 + 1
	data = list(range(len_nums + 2))
	for i in range(2, int(len_nums ** 0.5) + 1):
		if data[i]:
			for j in range(i * i, len_nums, i):
				data[j] = 0
	return list(map(lambda i: i ** 2, filter(lambda i: i, data[2:])))

def binary_search(a, x, lo=0, hi=None):
	hi = hi if hi is not None else len(a)
	pos = bisect_left(a, x, lo, hi)
	return pos if pos != hi and a[pos] == x else -1
data = get_sieve()
print('\n'.join(['YES' if binary_search(data, n) != -1 else 'NO' for n in nums]))


from math import sqrt
N = 1000005
s = [True] * N
p = 2
while p * p <= N:
	if s[p] == True:
		for i in range(p * 2, N, p):
			s[i] = False
	p += 1
x = input()
x = [int(i) for i in input().split()]
for num in x:
	root = int(sqrt(num))
	if num > 3 and s[root] and (num == root * root):
		print('YES')
	else:
		print('NO')


import math

def getPrimes():
	n = 10 ** 6 + 1
	seive = [0] * (n + 1)
	seive[0] = 1
	seive[1] = 1
	for i in range(2, int(math.sqrt(n)) + 1):
		if seive[i] == 0:
			for j in range(i, n + 1):
				if j * i > n:
					break
				elif seive[i * j] == 0:
					seive[i * j] = 1
	return seive
n = int(input())
li = list(map(int, input().split()))
totPrimes = getPrimes()
for i in range(n):
	temp = int(math.sqrt(li[i]))
	if totPrimes[temp] == 0 and temp * temp == li[i]:
		print('YES')
	else:
		print('NO')


def eratosthenes(n):
	IsPrime = [True] * (n + 1)
	for i in range(2, int(n ** 0.5) + 1):
		if IsPrime[i]:
			for j in range(i * i, n + 1, i):
				IsPrime[j] = False
	return IsPrime
a = int(input())
b = [int(i) for i in input().split()]
primes = eratosthenes(1000000)
for i in range(a):
	r = b[i] ** 0.5
	if b[i] == 1:
		print('NO')
		continue
	if r == int(r):
		if bool(primes[int(b[i] ** 0.5)]) == True:
			print('YES')
			continue
	print('NO')


N = 10 ** 6

def rwh_primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]
pq = set([v * v for v in rwh_primes(N)])
n = int(input())
for v in map(int, input().split()):
	if v in pq:
		print('YES')
	else:
		print('NO')


import math

def get_primes(upper_limit):
	primes = [True] * (upper_limit + 1)
	size = int(math.ceil(math.sqrt(len(primes))))
	(primes[0], primes[1]) = (False, False)
	for i in range(2, size):
		if primes[i]:
			for j in range(2 * i, len(primes), i):
				primes[j] = False
	return primes
primes = get_primes(1000000)
n_values = int(input())
values = map(int, input().split())
for v in values:
	sqrt_v = math.sqrt(v)
	answer = primes[int(sqrt_v)] if sqrt_v % 1 == 0 else False
	print('YES') if answer else print('NO')


def sieve(n):
	s = [True] * (n + 1)
	for i in range(2, int(n ** 0.5) + 1):
		if s[i]:
			p = i * i
			while p <= n:
				s[p] = False
				p += i
	return set([4] + [x * x for x in range(3, n, 2) if s[x]])

def solve(arr):
	s = sieve(int(1000000.0))
	for i in arr:
		found = i in s
		print('YES' if found else 'NO')

def test_time():
	from random import randint
	from time import time
	start = time()
	solve((randint(1, 1000000000000.0) for _ in range(int(100000.0))))
	print(time() - start)
input()
solve(map(int, input().split()))


def seive(m):
	primes = [True] * m
	for i in range(2, m):
		if primes[i]:
			for j in range(2 * i, m, i):
				primes[j] = False
	return primes
n = int(input())
l = list(map(int, input().split()))
primes = seive(1000000)
s = set()
for i in range(len(primes)):
	if primes[i]:
		s.add(i ** 2)
for i in l:
	if i == 1:
		print('NO')
		continue
	if i in s:
		print('YES')
	else:
		print('NO')


primo = [1] * 1000001

def Raiz(x):
	raiz = int(x ** 0.5) - 1
	if raiz * raiz == x:
		return raiz
	raiz += 1
	if raiz * raiz == x:
		return raiz
	raiz += 1
	if raiz * raiz == x:
		return raiz
	return -1
primo[0] = 0
primo[1] = 0
for i in range(2, 1001):
	if primo[i] == 1:
		for j in range(i * i, 1000001, i):
			primo[j] = 0
n = int(input())
entrada = input().split(' ')
numeros = [int(x) for x in entrada]
for i in numeros:
	raiz = Raiz(i)
	if raiz != -1 and primo[raiz]:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	if a[i] == 1:
		print('NO')
		continue
	b = int(math.sqrt(a[i]))
	if b * b != a[i] and (b + 1) * (b + 1) != a[i]:
		print('NO')
		continue
	if (b + 1) * (b + 1) == a[i]:
		b = b + 1
	ans = 1
	for j in range(2, int(math.sqrt(b)) + 1):
		if b % j == 0:
			ans = 0
			break
	if ans:
		print('YES')
	else:
		print('NO')


input()

def f(n):
	m = int(n ** 0.5) + 1
	t = [1] * (n + 1)
	for i in range(3, m):
		if t[i]:
			t[i * i::2 * i] = [0] * ((n - i * i) // (2 * i) + 1)
	return [4] + [i * i for i in range(3, n, 2) if t[i]]
p = set(f(1000000))
print('\n'.join(('NYOE S'[int(i) in p::2] for i in input().split())))


def LinearSieve(r):
	Isprime = [False for i in range(r + 1)]
	(Isprime[0], Isprime[1]) = (True, True)
	prime = []
	for i in range(2, r + 1):
		if Isprime[i] == False:
			prime.append(i)
		for j in prime:
			if i * j > r:
				break
			Isprime[i * j] = True
			if i % j == 0:
				break
	return Isprime
s = LinearSieve(1000000)
input()
for x in input().split():
	y = int(x)
	if int(y ** 0.5) ** 2 == y and s[int(y ** 0.5)] == 0:
		print('YES')
	else:
		print('NO')


import os
from io import BytesIO
input = BytesIO(os.read(0, os.fstat(0).st_size)).readline

def check(x):
	if x == 1:
		return False
	if x == 4 or x == 9:
		return True
	n = int(x ** 0.5)
	if n * n != x or n & 1 == 0 or n % 3 == 0:
		return False
	(cnt, sqrt_n) = (5, int(n ** 0.5))
	while cnt <= sqrt_n:
		if n % cnt == 0:
			return False
		cnt += 2 if cnt % 3 == 2 else 4
	return True

def main():
	input()
	os.write(1, '\n'.join(('YES' if check(xi) else 'NO' for xi in map(int, input().split()))).encode())
main()


def change(a):
	b = a ** 0.5
	if b == 1:
		return 0
	elif b % 1 == 0:
		return int(b)
	else:
		return 0
plis = [1 for i in range(1000001)]
p = 2
while p * p <= 1000000:
	if plis[p]:
		for i in range(2 * p, 1000001, p):
			plis[i] = 0
	p += 1
a = int(input())
lis1 = list(map(int, input().split()))
lis2 = list(map(change, lis1))
for i in lis2:
	if i == 0:
		print('NO')
	elif plis[i]:
		print('YES')
	else:
		print('NO')


N = 1000000
s = {4}
a = [1] * N
a[0] = a[1] = 0
for i in range(2, N):
	if a[i]:
		s.add(i * i)
		for j in range(i + i, N, i):
			a[j] = 0
input()
for d in map(int, input().split()):
	print(['NO', 'YES'][d in s])


import math
n = int(input())
l = list(map(int, input().split()))
maxn = 1000001
st = set()
vis = [1] * maxn
for i in range(2, maxn):
	if vis[i]:
		st.add(i * i)
		for j in range(2 * i, maxn, i):
			vis[j] = 0
for i in l:
	if i in st:
		print('YES')
	else:
		print('NO')


isolatedPrimes = [True] * 1000000
isolatedPrimes[0] = isolatedPrimes[1] = False
for i in range(2, 1000000):
	if isolatedPrimes[i]:
		for multiples in range(i * i, 1000000, i):
			isolatedPrimes[multiples] = False
totalTestCases = int(input())
testCases = [int(a) for a in input().split()]
for case in testCases:
	if case == 4:
		print('YES')
	elif case % 2 == 0:
		print('NO')
	elif int(case ** 0.5) == case ** 0.5:
		if isolatedPrimes[int(case ** 0.5)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt
N = int(1000000.0 + 1)
sieve = [True] * N
for i in range(2, N):
	if sieve[i]:
		for j in range(i + i, N, i):
			sieve[j] = False
n = int(input())
a = [int(_) for _ in input().split()]
for i in range(n):
	if a[i] < 3:
		print('NO')
		continue
	aa = int(sqrt(a[i]))
	if aa * aa == a[i] and sieve[aa]:
		print('YES')
	else:
		print('NO')


n = 1000001
ls = [1] * n
lt = set()
for i in range(2, n):
	if ls[i]:
		lt.add(i)
		for j in range(2 * i, n, i):
			ls[j] = 0
n = int(input())
lu = list(map(int, input().split()))
for i in lu:
	q = i ** 0.5
	print(['NO', 'YES'][q in lt])


n = int(input())
k = [int(x) for x in input().split()]
m = sorted(k)[-1]
l = [True] * int(m ** 0.5 + 1)
l[0] = l[1] = False
for i in range(int(m ** 0.5 + 1)):
	if l[i] == True:
		for j in range(i, int(m ** 0.5 + 1) - i, i):
			l[i + j] = False
for i in range(n):
	print('YES' if k[i] ** 0.5 == int(k[i] ** 0.5) and l[int(k[i] ** 0.5)] == True else 'NO')


import math
primes = [True] * (10 ** 6 + 1)
for i in range(2, 10 ** 3 + 1):
	if primes[i] == True:
		for j in range(2 * i, 10 ** 6 + 1, i):
			primes[j] = False
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	l = math.ceil(math.sqrt(a[i]))
	r = math.floor(math.sqrt(a[i]))
	if a[i] == 1:
		print('NO')
	elif l == r and primes[l]:
		print('YES')
	else:
		print('NO')


n = int(input())
u = input()
list = [int(x) for x in u.split()]

def primes(n):
	arr = []
	f = []
	for i in range(n + 1):
		if i > 2 and i % 2 == 0:
			f.append(1)
		else:
			f.append(0)
	i = 3
	while i * i <= n:
		if f[i] == 0:
			j = i * i
			while j <= n:
				f[j] = 1
				j += i + i
		i += 2
	arr.append(4)
	for x in range(3, n + 1, 2):
		if f[x] == 0:
			arr.append(x ** 2)
	return arr
n = 1000000
arr = primes(n)
for x in list:

	def binarySearch(arr, l, r, x):
		if l <= r:
			mid = (l + r) // 2
			if arr[mid] == x:
				return mid
			elif arr[mid] > x:
				return binarySearch(arr, l, mid - 1, x)
			else:
				return binarySearch(arr, mid + 1, r, x)
		else:
			return -1
	result = binarySearch(arr, 0, len(arr) - 1, x)
	if result == -1:
		print('NO')
	else:
		print('YES')


def isPrime(number):
	count = 0
	raiz = pow(number, 1 / 2)
	raiz = int(raiz)
	for i in range(1, raiz + 1):
		if number % i == 0:
			count += 1
			if number / i != i:
				count += 1
		if count >= 3:
			return False
	return True

def tPrimes(number):
	raiz = pow(number, 1 / 2)
	resto = raiz % 1
	if number == 1 or number == 2:
		print('NO')
	elif resto != 0:
		print('NO')
	else:
		raiz = int(raiz)
		if isPrime(raiz):
			print('YES')
		else:
			print('NO')
qtd = int(input())
numbers = input().split()
for i in range(qtd):
	tPrimes(int(numbers[i]))


def isPrime(n):
	if n == 0 or n == 1:
		return False
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
input()
arr = list(map(int, input().split()))
for num in arr:
	if num == 1:
		print('NO')
	elif (num ** 0.5).is_integer():
		sqr = int(num ** 0.5)
		if isPrime(sqr):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def count1(s):
	c = 0
	for i in s:
		if i == '1':
			c += 1
	return c

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True
n = int(input())
l = list(map(int, input().split()))
for t in l:
	if int(t ** 0.5) == t ** 0.5:
		r = int(t ** 0.5)
		if isPrime(r):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import *

def prime(x):
	if x < 2:
		return False
	for i in range(2, int(sqrt(x)) + 1):
		if x % i == 0:
			return False
	return True
n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	b = sqrt(a[i])
	if floor(b) == b:
		if prime(floor(b)):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def sieve(a):
	prime = [True for i in range(a + 1)]
	p = 2
	while p * p <= a:
		if prime[p]:
			for i in range(p * p, a + 1, p):
				prime[i] = False
		p += 1
	return prime
n = int(input())
A = list(map(int, input().split()))
a = int(1000000.0 + 2)
prime = sieve(a)
for i in A:
	c = i ** 0.5
	if c - int(c) != 0 or c == 1:
		print('NO')
		continue
	c = int(c)
	if prime[c]:
		print('YES')
	else:
		print('NO')


import math as m
n = 10 ** 6
arr = [1] * (n + 1)
arr[0] = -1
arr[1] = -1
for i in range(2, int(m.sqrt(n + 1)) + 1):
	if arr[i] == 1:
		for j in range(2 * i, n + 1, i):
			arr[j] = -1
mm = int(input())
num = list(map(int, input().split()))
for i in num:
	if int(m.sqrt(i)) == m.sqrt(i) and arr[int(m.sqrt(i))] == 1:
		print('YES')
	else:
		print('NO')


from math import sqrt

def isqrt(x):
	t = int(sqrt(x))
	if t * t == x:
		return t
	else:
		return -1
pprimes = {}

def isPrime(k):
	if k in pprimes:
		return pprimes[k]
	for i in range(2, int(sqrt(k) + 1)):
		if k % i == 0:
			pprimes[k] = False
			return False
	pprimes[k] = True
	return True

def primes2(n):
	(n, correction) = (n - n % 6 + 6, 2 - (n % 6 > 1))
	sieve = [True] * (n // 3)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if sieve[i]:
			k = 3 * i + 1 | 1
			sieve[k * k // 3::2 * k] = [False] * ((n // 6 - k * k // 6 - 1) // k + 1)
			sieve[k * (k - 2 * (i & 1) + 4) // 3::2 * k] = [False] * ((n // 6 - k * (k - 2 * (i & 1) + 4) // 6 - 1) // k + 1)
	return [2, 3] + [3 * i + 1 | 1 for i in range(1, n // 3 - correction) if sieve[i]]

def binary_search(a, x, lo=0, hi=None):
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		midval = a[mid]
		if midval < x:
			lo = mid + 1
		elif midval > x:
			hi = mid
		else:
			return mid
	return -1
_ = input()
numbers = map(int, input().split())
known = {}
primes = primes2(10 ** 6)
for n in numbers:
	sq = isqrt(n)
	if n in known:
		print(known[n])
	elif sq == -1:
		known[n] = 'NO'
		print('NO')
	else:
		if binary_search(primes, sq) != -1:
			known[n] = 'YES'
		else:
			known[n] = 'NO'
		print(known[n])


input()
primes = [0] * int(1000000.0)
s = set()
for i in range(2, int(1000000.0)):
	if not primes[i]:
		s.add(i * i)
		primes[i * i::i] = [1] * len(primes[i * i::i])
for i in map(int, input().split()):
	print('YES' if i in s else 'NO')


n = int(input())
maxn = 10 ** 6 + 1
p = [1] * (maxn + 1)
ans = {4}
for i in range(2, maxn + 1):
	if p[i] == 1:
		for j in range(i * i, maxn + 1, i):
			p[j] = 0
		ans.add(i * i)
for d in map(int, input().split()):
	if d in ans:
		print('YES')
	else:
		print('NO')


import math

def isPrime(n):
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		if n % i == 0:
			return False
	return True
a = int(input())
b = list(map(int, input().split()))
for k in b:
	if k == 4:
		print('YES')
	elif k % 2 == 0:
		print('NO')
	elif k < 4:
		print('NO')
	else:
		g = math.sqrt(k)
		if g != int(g):
			print('NO')
		elif isPrime(int(g)):
			print('YES')
		else:
			print('NO')


Tprimes = set()
maxs = 1000001
primes = [1] * maxs
for i in range(2, maxs):
	if primes[i]:
		Tprimes.add(i * i)
		for j in range(i * 2, maxs, i):
			primes[j] = 0
num = int(input())
arr = [int(x) for x in input().split()]
for a in arr:
	if a in Tprimes:
		print('YES')
	else:
		print('NO')


input()
num = [int(x) for x in input().split()]
b = int(pow(max(num), 1 / 2)) + 1

def primes(n):
	f = []
	for i in range(n + 1):
		if i > 2 and i % 2 == 0:
			f.append(1)
		else:
			f.append(0)
	f[1] = 1
	i = 3
	while i * i <= n:
		if f[i] == 0:
			j = i * i
			while j <= n:
				f[j] = 1
				j += i + i
		i += 2
	return f
c = primes(b)
for x in num:
	a = pow(x, 1 / 2)
	d = int(a)
	if a == d:
		if c[d] == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt

def func1(n):
	if n == 1:
		return 'NO'
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return 'NO'
	return 'YES'
n = int(input())
s = list(map(int, input().split()))
for i in s:
	x = sqrt(i)
	if x == int(x):
		print(func1(int(x)))
	else:
		print('NO')


_ = input()
numbers = [int(i) for i in input().split()]
limit = 10 ** 6
tprimes = set()
lst = [1] * limit
for i in range(2, limit):
	if lst[i]:
		tprimes.add(i * i)
		for j in range(i * i, limit, i):
			lst[j] = 0
for num in numbers:
	print(['NO', 'YES'][num in tprimes])


n = 1000002
s = [1] * n
p = set()
for i in range(2, n):
	if s[i]:
		p.add(i * i)
		for j in range(i * 2, n, i):
			s[j] = 0
input()
a = list(map(int, input().split()))
for i in a:
	if i in p:
		print('YES')
	else:
		print('NO')


import math

def f(x):
	for i in range(2, math.floor(x ** 0.5) + 1):
		if x % i == 0:
			return False
	return True
a = int(input())
s = [int(x) for x in input().split()]
for i in s:
	if int(i ** 0.5) ** 2 == i and f(int(i ** 0.5)) and (i != 1):
		print('YES')
	else:
		print('NO')


a = input()
d = set()
multiplos = set()
for i in range(2, 1000001):
	if i not in multiplos:
		d.add(i * i)
		multiplos.update(range(i * i, 1000001, i))
for a in [int(b) for b in input().split()]:
	if a in d:
		print('YES')
	else:
		print('NO')


MAX = int(1000000.0 + 1)
sieve = [True] * MAX
sieve[0] = sieve[1] = False
tprimes = {4}
for i in range(2, MAX):
	if sieve[i]:
		tprimes.add(i * i)
		for j in range(i * i, MAX, i):
			sieve[j] = False
n = int(input())
a = list(map(int, input().split()))
for i in a:
	print(('NO', 'YES')[i in tprimes])


a = 10 ** 6
prime = [True] * (a + 1)
p = 2
while p * p <= a:
	if prime[p] == True:
		for i in range(p * 2, a + 1, p):
			prime[i] = False
	p += 1
n = int(input())
A = [int(x) for x in input().split()]
import math
for i in A:
	m = math.sqrt(i)
	if m != int(m):
		print('NO')
	elif m == 1:
		print('NO')
	elif prime[int(m)] == False:
		print('NO')
	else:
		print('YES')


import math

def inlt():
	return list(map(int, input().split()))

def isPrime(n):
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, int(math.sqrt(n)) + 1, 2):
		if n % i == 0:
			return False
	return True
t = int(input())
inps = inlt()
for inp in inps:
	flag = False
	n = int(math.sqrt(inp))
	if n * n == inp:
		if isPrime(n):
			flag = True
	if inp <= 2:
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


import math

def oula(r):
	prime = [0 for i in range(r + 1)]
	common = []
	for i in range(2, r + 1):
		if prime[i] == 0:
			common.append(i)
		for j in common:
			if i * j > r:
				break
			prime[i * j] = 1
			if i % j == 0:
				break
	return common
common = oula(1000)

def prime(s):
	if s < 2:
		return False
	for i in common:
		if i >= s:
			return True
		if s % i == 0:
			return False
	return True
n = int(input())
l1 = [int(x) for x in input().split()]
for i in range(n):
	sqr = math.sqrt(l1[i])
	if int(sqr) == sqr:
		if prime(int(sqr)) == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
line = [int(x) for x in input().split()]
pool = set()
n = 10 ** 6 + 3
a = [1] * n
for i in range(2, n):
	if a[i]:
		for j in range(i * i, n, i):
			a[j] = 0
		pool.add(i * i)
for i in range(len(line)):
	if line[i] in pool:
		print('YES')
	else:
		print('NO')


import math
rangeOfNum = 1000000
primes = []
sieve = [True] * (rangeOfNum + 1)
sieve[0] = False
sieve[1] = False
p = 2
while p * p <= rangeOfNum:
	if sieve[p] == True:
		for i in range(p + p, rangeOfNum + 1, p):
			sieve[i] = False
	p += 1

def binSearch(lower, upper, numList, num):
	if upper >= lower:
		mid = int(lower + (upper - lower) / 2)
		if numList[mid] == num:
			return mid
		elif numList[mid] > num:
			return binSearch(lower, mid - 1, numList, num)
		else:
			return binSearch(mid + 1, upper, numList, num)
	else:
		return -1
n = int(input())
for num in input().split():
	root = math.sqrt(int(num))
	if int(root + 0.5) ** 2 == int(num):
		root = int(root)
		if sieve[root] == False:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


__author__ = 'Dilshod'
p = [True] * 1000100
p[1] = False
for i in range(2, 1100):
	if p[i]:
		for j in range(i + i, 1000100, i):
			p[j] = False
from math import sqrt as root
n = int(input())
m = list(map(int, input().split()))
ans = ''
answer = []
for i in range(n):
	if m[i] == 1:
		answer += ['NO']
		continue
	m[i] = root(m[i])
	a = str(m[i])
	if a[-2] != '.' or (m[i] % 2 == 0 and m[i] != 2):
		answer += ['NO']
		continue
	m[i] = int(m[i])
	if p[m[i]]:
		answer += ['YES']
	else:
		answer += ['NO']
print('\n'.join(answer))


def GeneratePrimesUpTo(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]
PRIMES = set(GeneratePrimesUpTo(1000000))
input()
for x in map(int, input().split()):
	sqrt_x = int(x ** 0.5)
	print('YES' if sqrt_x ** 2 == x and sqrt_x in PRIMES else 'NO')


import typing
import math
import collections

def rit(*args) -> typing.Iterator:
	(func, funcs) = (int, (int, float, str))
	sep = ' '
	for a in args:
		if a in funcs:
			func = a
		elif isinstance(a, str):
			sep = a
	return map(func, input().strip().split(sep))

def pit(itr: typing.Iterable, sep: str=' ') -> None:
	print(sep.join(map(str, itr)))

def main():
	MAX_CHECK = 10 ** 3
	n = int(input())
	if n > 1:
		xs = rit()
	else:
		xs = [int(input())]
	primes = collections.deque([2])
	for n in range(3, MAX_CHECK + 1):
		for p in primes:
			if n % p == 0:
				break
		else:
			primes.append(n)

	def is_prime(n, primes):
		if n < 2:
			return False
		sq = math.sqrt(n)
		for p in primes:
			if p > sq:
				break
			if n % p == 0:
				return False
		return True
	for x in xs:
		sqi = int(math.sqrt(x))
		if sqi ** 2 == x and is_prime(sqi, primes):
			print('YES')
		else:
			print('NO')
main()


x = int(input(''))
ar = map(int, input('').split())
n = 1000000
c = [0, 0] + [1] * n
r = set()
for i in range(2, n):
	if c[i]:
		for j in range(i * i, n, i):
			c[j] = 0
		r.add(i * i)
for i in ar:
	print('YES' if i in r else 'NO')


from math import sqrt
n = int(input())
a = [int(i) for i in input().split()]

def isPrime(n):
	c = 0
	for j in range(2, int(sqrt(n)) + 1):
		if n % j == 0:
			return False
	return True
for i in a:
	if i == 1:
		print('NO')
	elif sqrt(i) == int(sqrt(i)):
		if isPrime(int(sqrt(i))):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
arr = [int(x) for x in input().split()]
t = 1000001
primes = [True for x in range(t)]
p = 2
while p * p < t:
	if primes[p]:
		for x in range(2 * p, t, p):
			primes[x] = False
	p += 1
primes[0] = False
primes[1] = False
for num in arr:
	a = int(math.sqrt(num))
	print('YES') if primes[a] and a * a == num else print('NO')


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007
n = I()
l = 1000002
c = [1, 1] + [0] * l
for i in range(2, l):
	if 1 - c[i]:
		for j in range(i * i, l, i):
			c[j] = 1
arr = L()
for i in arr:
	x = int(math.sqrt(i))
	if x * x == i:
		if c[x] == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def xxs(n):
	isprimes = [True] * (n + 1)
	isprimes[1] = 0
	primes = []
	for i in range(2, n):
		if isprimes[i] == 1:
			primes.append(i)
		for j in primes:
			if j * i > n:
				break
			isprimes[i * j] = 0
			if i % j == 0:
				break
	return isprimes
n = int(input())
l = [int(x) for x in input().split()]
ln = xxs(1000000)
for i in l:
	sq = i ** 0.5
	if int(sq) * int(sq) != i:
		print('NO')
	elif ln[int(i ** 0.5)] == 1:
		print('YES')
	else:
		print('NO')


l = 1000001
isnotPrime = [1, 1] + [0] * l
for i in range(2, l):
	if isnotPrime[i] == 0:
		for j in range(i * i, l, i):
			isnotPrime[j] = 1
n = int(input())
k = [int(z) for z in input().split()]
for i in range(n):
	print(['NO', 'YES'][int(k[i] ** 0.5) ** 2 == k[i] and (not isnotPrime[int(k[i] ** 0.5)])])


def isKprime(num, k=3):
	ctr = 2
	sqr = int(num ** 0.5)
	for i in range(2, sqr + 1):
		if ctr >= 4:
			return False
		if num % i == 0:
			if num // i == i:
				ctr += 1
			else:
				ctr += 2
	return ctr == k

def seive(n):
	primes = [1] * (n + 1)
	i = 2
	primes[0] = 0
	primes[1] = 0
	while i * i <= n:
		if primes[i] == 1:
			for j in range(i * i, n + 1, i):
				primes[j] = 0
		i += 1
	actualPrime = {}
	for j in range(len(primes)):
		if primes[j] == 1:
			actualPrime[j] = 1
	return actualPrime
input()
primes = seive(1000000)
lis = list(map(int, input().split()))
for i in lis:
	value1 = i ** 0.5
	value2 = int(i ** 0.5)
	if value1 in primes and value1 == value2:
		print('YES')
	else:
		print('NO')


import math
n = 1000000
prime = {}
p = 2
while p * p <= n:
	if p not in prime:
		for i in range(p * p, n + 1, p):
			prime[i] = 'composite'
	p += 1
N = int(input())
x = map(int, input().split())
for e in x:
	pr = math.sqrt(e)
	if pr not in prime and pr == int(pr) and (pr != 1):
		print('YES')
	else:
		print('NO')


a = [True] * (10 ** 6 + 1000)

def primes_sieve2(limit):
	a[0] = a[1] = False
	l = []
	for (i, isprime) in enumerate(a):
		if isprime:
			l.append(i)
			for n in range(i * i, limit, i):
				a[n] = False
	return l
primes_sieve2(10 ** 6 + 1000)
from collections import *
vis = defaultdict(lambda : False)
for i in range(1, 10 ** 6 + 1000):
	if a[i]:
		vis[i ** 2] = True
n = int(input())
l = [int(i) for i in input().split()]
for i in l:
	if vis[i]:
		print('YES')
	else:
		print('NO')


n = int(input())
s = [0] * 2 + [1] * 1000001
for x in range(2, 1001):
	if s[x]:
		s[2 * x::x] = [0] * ((1000001 - 2 * x + 1) // x + 1)
for i in map(int, input().split()):
	print(['NO', 'YES'][int(i ** 0.5) == i ** 0.5 and s[int(i ** 0.5)]])


n = input()
n = int(n)
num = [int(x) for x in input().split()]
for i in num:
	prime = True
	if i == 1 or i == 2 or i == 3:
		print('NO')
	elif i ** 0.5 == int(i ** 0.5):
		p = int(i ** 0.5)
		for i in range(2, int(p ** 0.5) + 1):
			if p % i == 0:
				prime = False
				break
		if prime == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import *

def isprime(n):
	if n == 2 or n == 3:
		return True
	if n % 2 == 0 or n % 3 == 0 or n <= 1:
		return False
	x = 5
	while x * x <= n:
		if n % x == 0 or n % (x + 2) == 0:
			return False
		x += 6
	return True
n = int(input())
l = [*map(int, input().split())]
for i in range(n):
	if l[i] == 1:
		print('NO')
		continue
	x = l[i] ** 0.5
	if ceil(x) == floor(x) and isprime(int(x)):
		print('YES')
	else:
		print('NO')


import math

def prime_check(num):
	limit = int(math.sqrt(num)) + 1
	counter = 0
	for divisor in range(2, limit):
		if num % divisor == 0:
			counter += 1
	if not counter:
		return True
	return False
n_input = input()
numbers = input()
numbers = numbers.split(' ')
for i in range(0, len(numbers)):
	num = int(numbers[i])
	test = int(math.sqrt(num) * 100000)
	if (test % 100000 != 0) | (test == 100000):
		print('NO')
	else:
		test = int(test / 100000)
		if (test % 2 == 0) & (test == 2):
			print('YES')
		elif (test % 2 == 0) & (test != 2):
			print('NO')
		elif prime_check(test):
			print('YES')
		else:
			print('NO')


import math
n = int(input())
s = list(map(int, input().split()))

def factors(n):
	z = int(math.sqrt(n))
	if z * z != n:
		return 'NO'
	else:
		k = 5
		for i in range(z):
			if k * k <= z:
				if z % k == 0 or z % (k + 2) == 0:
					return 'NO'
				k = k + 6
			else:
				break
	return 'YES'
for i in s:
	if i == 4 or i == 9 or i == 25 or (i == 49):
		print('YES')
	elif i == 1:
		print('NO')
	elif i % 2 == 0 and i != 4:
		print('NO')
	elif i % 3 == 0 and i != 9:
		print('NO')
	elif i % 5 == 0 and i != 25:
		print('NO')
	else:
		print(factors(i))


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def main():
	n = int(input())
	arr = array()
	for num in arr:
		if int(num ** 0.5) ** 2 == num:
			if isPrime(int(num ** 0.5)):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
t = 1
for _ in range(t):
	main()


n = int(input())
a = list(map(int, input().split()))

def pr(n):
	pn = set()
	n = int(n)
	mark = [True for i in range(n + 2)]
	for p in range(2, int(n ** 0.5) + 2):
		if mark[p] == True:
			for i in range(p ** 2, n + 2, p):
				mark[i] = False
		p += 1
	for p in range(2, n + 1):
		if mark[p]:
			pn.add(p ** 2)
	return pn
p = pr(int(max(a) ** 0.5) + 1)
for i in a:
	if i in p:
		print('YES')
	else:
		print('NO')


import sys
f = sys.stdin
n = int(f.readline())
t = [int(i) for i in f.readline().strip().split()]
N = 10 ** 6 + 1
k = [True] * N
a = set()
for i in range(2, N):
	if k[i]:
		a.add(i ** 2)
		for j in range(i, N, i):
			k[j] = False
for i in t:
	if i in a:
		print('YES')
	else:
		print('NO')


from collections import *
from sys import stdin
from math import *

def count_prime(n):
	prim = defaultdict(lambda : 1)
	prim[0] = prim[1] = 0
	i = 2
	while i * i <= n:
		if prim[i]:
			for j in range(i * 2, n + 1, i):
				prim[j] = 0
		i += 1
	return prim

def arr_inp(n):
	if n == 1:
		return [int(x) for x in stdin.readline().split()]
	elif n == 2:
		return [float(x) for x in stdin.readline().split()]
	else:
		return [str(x) for x in stdin.readline().split()]

def pow1(x, base):
	if base == 0:
		return 1
	sq = pow1(x, base // 2)
	sq = sq * sq
	if base % 2:
		sq *= x
	return sq
primes = count_prime(1000000)
(n, a) = (int(input()), arr_inp(2))
for i in a:
	s = int(sqrt(i))
	if i > 1 and s * s == i:
		if primes[s]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt, ceil

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	dic = {}
	a = []
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for i in range(2, n + 1):
		if prime[i]:
			dic[i] = 1
	return dic
a = sieve(1000005)
y = int(input())
z = list(map(int, input().split()))
for i in z:
	n = sqrt(i)
	if n == ceil(n):
		try:
			if a[n]:
				print('YES')
		except KeyError:
			print('NO')
	else:
		print('NO')


n = 2 ** 20
arr = [1] * n
b = {4}
for i in range(2, n):
	if arr[i]:
		for j in range(i * i, n, i):
			arr[j] = 0
		b.add(i * i)
input()
for d in map(int, input().split()):
	print(['NO', 'YES'][d in b])


from sys import stdin, stdout
from collections import Counter

def ai():
	return list(map(int, stdin.readline().split()))

def ei():
	return map(int, stdin.readline().split())

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
from math import ceil

def seive(n, prime):
	prime[0] = prime[1] = False
	for i in range(2, int(math.sqrt(1000000)) + 1):
		if prime[i]:
			for j in range(2 * i, 1000001, i):
				prime[j] = False
	return prime
import math

def isPerfectSquare(x):
	sr = math.sqrt(x)
	return sr - math.floor(sr) == 0
prime = [True for i in range(1000001)]
seive(1000000, prime)
n = ip()
li = ai()
for i in li:
	if isPerfectSquare(i) and prime[int(math.sqrt(i))]:
		print('YES')
	else:
		print('NO')


n = int(input())
x = list(map(int, input().split()))
s = 10 ** 6 + 1
a = s * [1]
a[1] = 0
i = 2
while i <= s ** 0.5:
	if a[i] == 1:
		for j in range(i * i, s, i):
			a[j] = 0
	i += 1
for i in range(n):
	if int(x[i] ** 0.5) != x[i] ** 0.5:
		print('NO')
	elif a[int(x[i] ** 0.5)] == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
from math import sqrt

def prime(n):
	if n <= 1:
		return 0
	if n <= 3:
		return 1
	if not n % 2 or not n % 3:
		return 0
	for i in range(5, int(sqrt(n)) + 1, 6):
		if not n % i or not n % (i + 2):
			return 0
	return 1

def three(n):
	sq = int(sqrt(n))
	if sq ** 2 != n:
		return 0
	if prime(sq):
		return 1
	else:
		return 0
for i in range(n):
	if three(a[i]):
		print('YES')
	else:
		print('NO')


b = 10 ** 6 + 1
primes = [False] * b
primes[1] = True
for i in range(2, b):
	if primes[i] == False:
		for j in range(2 * i, b, i):
			primes[j] = True
n = int(input())
l = list(map(int, input().split()))
for i in l:
	if i ** 0.5 == int(i ** 0.5):
		if primes[int(i ** 0.5)] == False:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	k = int(sqrt(n)) + 1
	for i in range(5, k, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def isThreeDisctFactors(n):
	sq = int(sqrt(n))
	if 1 * sq * sq != n:
		return False
	if isPrime(sq):
		return True
	else:
		return False
n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	num = l[i]
	if isThreeDisctFactors(num):
		print('YES')
	else:
		print('NO')


import math
n = int(input())
d = input().split(' ')
primes = [True] * 1000005
primes[1] = False
primes[0] = False
for i in range(2, 1000005, 1):
	if primes[i] == True:
		for j in range(2 * i, 1000005, i):
			primes[j] = False
	if i * i >= 1000005:
		break
for i in range(0, n, 1):
	num = math.sqrt(int(d[i]))
	if math.ceil(num) != math.floor(num):
		print('NO')
	elif math.ceil(num) == math.floor(num) and int(num) == 1:
		print('NO')
	else:
		num = int(num)
		if primes[num] == True:
			print('YES')
		else:
			print('NO')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

@lru_cache(None)
def prime(x):
	if x == 2:
		return True
	for i in range(2, int(x ** 0.5) + 2):
		if x % i == 0 and x != i:
			return False
	return True
n = L()[0]
A = L()
for i in range(n):
	if A[i] == 1:
		print('NO')
		continue
	x = int(A[i] ** 0.5)
	if x * x == A[i]:
		if prime(x):
			print('YES')
			continue
	print('NO')
endtime = time.time()


limit = 2 ** 20
valid = {4}
could_be = [1] * limit
for i in range(2, limit):
	if could_be[i]:
		valid.add(i * i)
		for j in range(i * i, limit, i):
			could_be[j] = 0
_ = int(input())
given = [int(x) for x in input().split()]
for i in given:
	print(['NO', 'YES'][i in valid])


def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
n = int(input())
a = list(map(int, input().split()))
primes = sieve(10 ** 6)
for i in range(n):
	sqrt = a[i] ** 0.5
	if a[i] != 1 and int(sqrt) == sqrt:
		if not primes[int(sqrt)]:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


def euler(r):
	prime = [0 for i in range(r + 1)]
	common = []
	for i in range(2, r + 1):
		if prime[i] == 0:
			common.append(i)
		for j in common:
			if i * j > r:
				break
			prime[i * j] = 1
			if i % j == 0:
				break
	return prime
s = euler(1000000)
input()
for i in map(int, input().split()):
	if i < 4:
		print('NO')
		continue
	elif int(i ** 0.5) ** 2 != i:
		print('NO')
		continue
	if s[int(i ** 0.5)] == 0:
		print('YES')
	else:
		print('NO')


def nizhishu(n, prime):
	p = 2
	while p * p <= n:
		if prime[p]:
			for j in range(p * p, n + 1, p):
				prime[j] = False
		p += 1
n = int(input())
l = [int(x) for x in input().split()]
prime = [True] * (10 ** 6 + 1)
nizhishu(10 ** 6, prime)
for i in l:
	if i < 4:
		print('NO')
	elif int(i ** 0.5) != i ** 0.5:
		print('NO')
	elif prime[int(i ** 0.5)]:
		print('YES')
	else:
		print('NO')


import math
a = [True] * (10 ** 6 + 1)
a[0] = False
a[1] = False
for i in range(2, 10 ** 3 + 1, 1):
	if a[i]:
		for j in range(2 * i, 10 ** 6 + 1, i):
			a[j] = False
n = int(input())
s = list(map(int, input().split()))
for i in range(n):
	if int(math.sqrt(s[i])) == math.sqrt(s[i]):
		if a[int(math.sqrt(s[i]))]:
			print('YES', end='\n')
		else:
			print('NO', end='\n')
	else:
		print('NO', end='\n')


import math
n = 1000001
a = [0 for i in range(n)]
p = 2
a[0] = a[1] = 1
for p in range(2, int(math.sqrt(n)) + 1):
	if a[p] == 0:
		for i in range(p * p, n, p):
			a[i] = 1
z = int(input())
lis = list(map(int, input().split()))
for i in range(z):
	s = math.sqrt(lis[i])
	if s == 1:
		print('NO')
	elif s == int(s):
		if a[int(s)] == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
from math import sqrt
a = list(map(int, input().split()))

def prime():
	u = 10 ** 6
	l = [0] * u
	i = 2
	s = []
	while i != u:
		if l[i] != '#':
			for j in range(i + i, u, i):
				l[j] = '#'
		i += 1
	for i in range(2, len(l)):
		if l[i] != '#':
			s.append(i)
	return s
s = set(prime())
for i in a:
	if sqrt(i) in s:
		print('YES')
	else:
		print('NO')


import math

def getPrimes(n):
	primes = [True] * (n + 1)
	primes[0] = primes[1] = False
	i = 2
	while i * i <= n:
		if primes[i]:
			primes[i * i:n + 1:i] = [False] * int((n - i * i) / i + 1)
		i += 1
	return primes
primes = getPrimes(1000000)
n = input()
nums = map(int, input().split())
for num in nums:
	p = int(math.sqrt(num))
	print('YES' if p * p == num and primes[p] else 'NO')


primes = [True for i in range(10 ** 6 + 1)]
primes[1] = False

def findPrimes():
	p = 2
	while p * p <= 10 ** 6:
		if primes[p]:
			for i in range(p * p, 10 ** 6 + 1, p):
				primes[i] = False
		p += 1
tPrimes = {}

def findTprimes():
	for i in range(len(primes)):
		if primes[i]:
			tPrimes[i * i] = 1

def main():
	findPrimes()
	findTprimes()
	n = int(input())
	a = [int(i) for i in input().split()]
	for i in a:
		if i in tPrimes:
			print('YES')
		else:
			print('NO')
main()


def Sieve(n):
	Isprime = [True] * n
	(Isprime[0], Isprime[1]) = (False, False)
	Primes = []
	for i in range(2, n):
		if Isprime[i] == True:
			Primes.append(i)
		for p in Primes:
			if p * i >= n:
				break
			Isprime[p * i] = False
			if i % p == 0:
				break
	return Isprime
s = Sieve(1000001)
m = int(input())
for x in map(int, input().split()):
	y = int(x ** 0.5)
	if y * y == x and s[y]:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
k = int(1000000.0 + 2)
sieve = [True] * k
sieve[1] = sieve[0] = False
for i in range(2, k):
	if sieve[i] == True:
		for j in range(i * i, k, i):
			sieve[j] = False
for i in a:
	if int(i ** 0.5) == i ** 0.5 and sieve[int(i ** 0.5)] == True:
		print('YES')
	else:
		print('NO')


import math
prime = [True for i in range(1000000 + 1)]

def SieveOfEratosthenes(n):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
n = int(input())
arr = [int(x) for x in input().split()]
maximum = -1
for i in range(0, n):
	if arr[i] > maximum:
		maximum = arr[i]
maximum = int(math.sqrt(maximum + 1))
SieveOfEratosthenes(maximum)
for i in range(0, n):
	s = int(math.sqrt(arr[i]))
	if s * s == arr[i] and prime[s] == True and (s != 1):
		print('YES')
	else:
		print('NO')


def primes(n):
	sieve = set(range(3, n + 1, 2))
	if n >= 2:
		sieve.add(2)
	for i in range(3, int(n ** 0.5) + 1, 2):
		if i in sieve:
			sieve -= set(range(2 * i, n + 1, i))
	return sieve
n = input()
a = [int(el ** 0.5) if int(el ** 0.5) ** 2 == el else 1 for el in map(int, input().split())]
primes_a = primes(max(a))
res = []
for el in a:
	res.append('YES' if el in primes_a else 'NO')
print('\n'.join(res))


import math

def sq(n):
	x = math.sqrt(n)
	if x - math.floor(x) == 0:
		return int(x)
	else:
		return -1

def fun():
	prime = [True] * 1000001
	prime[0] = False
	prime[1] = False
	for i in range(2, 10001):
		if prime[i] == False:
			continue
		j = i
		while i * j < 1000001:
			prime[i * j] = False
			j += 1
	n = int(input())
	a = list(map(int, input().split()))
	for i in a:
		x = sq(i)
		if i == 1:
			print('NO')
		elif x != -1:
			if prime[x]:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
fun()


n = 2 ** 20
ehPrimo = [1] * n
ehPrimo[0] = 0
ehPrimo[1] = 0
tPrimes = {4}
for i in range(2, n):
	if ehPrimo[i]:
		tPrimes.add(i * i)
		for j in range(i * 2, n, i):
			ehPrimo[j] = 0
n = int(input())
for e in map(int, input().split()):
	if e in tPrimes:
		print('YES')
	else:
		print('NO')


import bisect
prm = set()

def x(n):
	xx = [True for i in range(n + 1)]
	p = 2
	while p <= n:
		if xx[p]:
			prm.add(p ** 2)
			for i in range(p * 2, n + 1, p):
				xx[i] = False
		p += 1
x(1000000)
n = int(input())
li = [int(i) for i in input().split(' ')]
for i in li:
	if i in prm:
		print('YES')
	else:
		print('NO')


n = 10 ** 6 + 1
a = [1] * n
a[1] = 0
for i in range(2, n):
	if a[i]:
		for j in range(i * i, n, i):
			a[j] = 0
input()
for x in map(int, input().split()):
	print(['NO', 'YES'][a[int(x ** 0.5)] * (x ** 0.5 == int(x ** 0.5))])


limit = 1000000

def isprime():
	prime_flag = [True] * limit
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, limit):
		if prime_flag[i] == True:
			for j in range(i * i, limit, i):
				prime_flag[j] = False
	return prime_flag

def isprimeT(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if prime_flag[int(sqrt_n)] == True:
			return True
	return False
prime_flag = isprime()
n = int(input())
l = map(int, input().split(' '))
for i in l:
	a = isprimeT(i)
	if a == True:
		print('YES')
	else:
		print('NO')


n = int(input())
array = list(map(int, input().split()))

def construct_primes():
	n = 10 ** 6 + 1
	primes = [True] * n
	p = 2
	while p ** 2 <= n:
		if primes[p]:
			for i in range(p * p, n, p):
				primes[i] = False
		p += 1
	return primes

def check(n):
	sqrt = n ** 0.5
	if int(sqrt) != sqrt:
		return False
	return primes[int(sqrt)]
primes = construct_primes()
for i in array:
	if i == 1:
		print('NO')
	elif check(i):
		print('YES')
	else:
		print('NO')


n = 1000000
n = n + 1
p = [1] * n
(p[0], p[1]) = (0, 0)
n1 = int(n ** 0.5)
for i in range(2, n1):
	if p[i] == 1:
		for j in range(i * i, n, i):
			p[j] = 0
input()
for i in input().split():
	i = int(i)
	i2 = int(i ** 0.5)
	print(['NO', 'YES'][p[i2] == 1 and i2 * i2 == i])


from math import *

def isPrime(n):
	if n == 2 or n == 3:
		return True
	if n % 2 == 0 or n < 2:
		return False
	for i in range(3, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
input()
for i in map(int, input().split()):
	if sqrt(i) == int(sqrt(i)) and isPrime(int(sqrt(i))):
		print('YES')
	else:
		print('NO')


import math

def primes(n):
	lista = [False, False]
	for i in range(2, n + 1):
		lista.append(True)
	sqrt = math.sqrt(n)
	p = 2
	while p <= sqrt:
		if lista[p]:
			for k in range(pow(p, 2), n + 1, p):
				lista[k] = False
		p += 1
	return lista
primes = primes(1000000)
n = int(input())
numbers = [int(x) for x in input().split()]
for i in numbers:
	sqrt = math.sqrt(i)
	res = 'NO'
	if sqrt.is_integer():
		if primes[int(sqrt)]:
			res = 'YES'
	print(res)


from math import sqrt

def sieve(arr):
	arr[0] = 1
	arr[1] = 1
	for i in range(2, 1001):
		if arr[i] == 0:
			for j in range(i * i, 1000001, i):
				arr[j] = 1
	return arr
arr = [0 for i in range(1000002)]
arr = sieve(arr)
n = int(input())
x = [int(x) for x in input().split()]
for i in x:
	square_root = int(sqrt(i))
	if 1 * square_root * square_root != i:
		print('NO')
	elif arr[square_root] == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
input = stdin.readline
input()
pr = [True] * 1000001
pr[1] = False
tpr = set()
for i in range(1, 1000001):
	if pr[i]:
		tpr.add(i * i)
		for j in range(i, 1000001, i):
			pr[j] = False
	pr[i] = True
for i in map(int, input().split()):
	stdout.write('YES\n' if i in tpr else 'NO\n')


import math
t = int(input())
lst = list(map(lambda x: int(x), input().split()))
MAX = 1000000
prime = [True] * (MAX + 1)
prime[0] = prime[1] = False
for i in range(2, int(math.sqrt(MAX))):
	if prime[i] == True:
		for j in range(i * i, len(prime), i):
			prime[j] = False
for i in lst:
	x = math.sqrt(i)
	if x.is_integer():
		if prime[int(x)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def SieveOfEratosthene(n):
	lst = [True for i in range(n + 1)]
	(lst[0], lst[1]) = (False, False)
	p = 2
	while p * p < n:
		if lst[p] == True:
			for i in range(p * p, n + 1, p):
				lst[i] = False
		p += 1
	return lst
new = SieveOfEratosthene(10 ** 6)
n = int(input())
lst = list(map(int, input().split()))
for i in lst:
	c = int(i ** 0.5)
	if c * c == i:
		if new[c]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from sys import *
from math import *
maxn = 10 ** 6 + 5
isprime = [True] * maxn

def sieve():
	isprime[0] = isprime[1] = False
	for i in range(4, maxn, 2):
		isprime[i] = False
	for i in range(3, maxn, 2):
		if i * i >= maxn:
			break
		if isprime[i] is True:
			for j in range(i * i, maxn, i + i):
				isprime[j] = False
sieve()
n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
for x in arr:
	sq = int(sqrt(x * 1.0))
	ok = False
	if sq * sq == x:
		if isprime[sq] is True:
			ok = True
	print('YES' if ok is True else 'NO')


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
p = [1] * 1000001
p[0] = p[1] = 0
for i in range(2, 1000001):
	if p[i]:
		for j in range(2 * i, 1000001, i):
			p[j] = 0
(n,) = I()
l = I()
for i in l:
	if i ** 0.5 == int(i ** 0.5) and p[int(i ** 0.5)]:
		print('YES')
	else:
		print('NO')


n = 10 ** 6
a = [1] * n
s = set()
for i in range(2, n):
	if a[i] == 1:
		s.add(i * i)
		for j in range(i * i, n, i):
			a[j] = 0
tt = int(input())
arr = map(int, input().split())
for x in arr:
	if x in s:
		print('YES')
	else:
		print('NO')


n = int(1000000.0)
A = [1] * n
A[0] = A[1] = 0
B = set()
for i in range(n):
	if A[i]:
		B.add(i ** 2)
		for j in range(i * 2, n, i):
			A[j] = 0
n = input()
C = list(map(int, input().split()))
for i in C:
	print('YES' if i in B else 'NO')


x = list(range(3, 10 ** 6 + 1, 2))
k = 0
for i in x:
	if i:
		x[k + i:len(x):i] = [0] * len(x[k + i:len(x):i])
	k += 1
x = set(filter(None, x))
x.add(2)
n = input()
a = list(map(int, input().split()))
for i in a:
	if i ** 0.5 in x:
		print('YES')
	else:
		print('NO')


import math

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
n = int(input())
SieveOfEratosthenes(1000000)
seq = list(map(int, input().split()))
for i in range(n):
	x = math.sqrt(seq[i])
	if x == int(x) and x != 1 and prime[int(x)]:
		print('YES')
	else:
		print('NO')


import math
limit = 1000000

def calculate_prime_flag(limit):
	prime_flag = [True] * limit
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, limit):
		if prime_flag[i] == True:
			for j in range(i * i, limit, i):
				prime_flag[j] = False
	return prime_flag
prime_flag = calculate_prime_flag(limit)
n = int(input())
nums = list(map(int, input().split()))
for number in nums:
	t_prime = False
	if number == 4:
		t_prime = True
	elif number % 2 != 0:
		number_sqrt = int(math.sqrt(number))
		if number_sqrt ** 2 == number and number > 1:
			t_prime = prime_flag[number_sqrt]
	if t_prime:
		print('YES')
	else:
		print('NO')


N = int(1000000.0)
is_prime = [0, 0] + [1] * N
for i in range(2, N + 2):
	if is_prime[i] == 0:
		continue
	for j in range(2 * i, N + 2, i):
		is_prime[j] = 0
n = int(input())
arr = [int(x) for x in input().split()]
for i in arr:
	if int(i ** 0.5) ** 2 == i and is_prime[int(i ** 0.5)] == 1:
		print('YES')
	else:
		print('NO')


MAX = pow(10, 6)
primos = set()

def crivo():
	aux = list([1] * MAX)
	aux[0] = 0
	aux[1] = 0
	for i in range(2, MAX):
		if aux[i] == 1:
			primos.add(i * i)
			for c in range(i * i, MAX, i):
				aux[c] = 0

def resolve(number):
	if number in primos:
		print('YES')
	else:
		print('NO')
crivo()
quant = int(input())
[resolve(int(i)) for i in input().split(' ')]


from math import *
n = int(input())
s = input().split()
d = int(sqrt(1000000000000))
primes = [True] * (d + 1)
primes[0] = False
primes[1] = False
for p in range(2, int(sqrt(d)) + 1):
	if primes[p] == True:
		for i in range(p * p, d + 1, p):
			primes[i] = False
for i in s:
	a = int(i)
	b = int(sqrt(a))
	if a == int(sqrt(a) + 0.5) ** 2:
		if primes[b] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
from math import sqrt, floor, factorial, gcd
from collections import deque, Counter, defaultdict
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def solve():
	vals = set()
	is_prime = [1 for i in range(10 ** 6 + 1)]
	is_prime[1] = 0
	i = 2
	while i * i < 10 ** 6 + 1:
		j = i
		if is_prime[j]:
			while j * i < 10 ** 6 + 1:
				is_prime[j * i] = 0
				j += 1
		i += 1
	for i in range(len(is_prime)):
		if is_prime[i]:
			vals.add(i ** 2)
	ans = ''
	n = int(inp())
	arr = read()
	for i in arr:
		ans += 'YNEOS'[not i in vals::2] + '\n'
	print(ans)
solve()


a = [True] * (10 ** 6 + 1)
b = {}
r = 10 ** 6 // 2 + 1
for i in range(2, r):
	if a[i] == False:
		continue
	for j in range(2 * i, 10 ** 6 + 1, i):
		a[j] = False
for i in range(2, 10 ** 6 + 1):
	if a[i] == True:
		b[i * i] = True
input()
a = list(map(int, input().split()))
for i in a:
	if i in b:
		print('YES')
	else:
		print('NO')


from functools import reduce
from collections import Counter
import time
import datetime
from math import sqrt, gcd

def time_t():
	print('Current date and time: ', datetime.datetime.now())
	print('Current year: ', datetime.date.today().strftime('%Y'))
	print('Month of year: ', datetime.date.today().strftime('%B'))
	print('Week number of the year: ', datetime.date.today().strftime('%W'))
	print('Weekday of the week: ', datetime.date.today().strftime('%w'))
	print('Day of year: ', datetime.date.today().strftime('%j'))
	print('Day of the month : ', datetime.date.today().strftime('%d'))
	print('Day of week: ', datetime.date.today().strftime('%A'))

def ip():
	return int(input())

def sip():
	return input()

def mip():
	return map(int, input().split())

def mips():
	return map(str, input().split())

def lip():
	return list(map(int, input().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)

def prime(n):
	for i in range(2, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
lst = [0] * 2 ** 20
final = []
for i in range(2, 2 ** 20):
	if lst[i] == 0:
		for j in range(i * i, 2 ** 20, i):
			lst[j] = 1
		final.append(i * i)
final = set(final)
n = ip()
arr = lip()
for item in arr:
	if item in final:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
data = input().split()

def isprime(x):
	if x == 1:
		return 0
	elif x in (2, 3, 5, 7, 11, 13, 17, 19):
		return 1
	elif x % 2 == 0 or x % 3 == 0 or x % 5 == 0 or (x % 7 == 0) or (x % 11 == 0) or (x % 13 == 0) or (x % 17 == 0) or (x % 19 == 0):
		return 0
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return 0
		return 1
for i in range(n):
	num = int(data[i])
	c = 'NO'
	if num == 1 or num == 2 or num == 3:
		print(c)
	else:
		q = math.sqrt(num)
		if q % 1 == 0.0:
			if isprime(int(q)):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


from math import *
n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	x = sqrt(l[i])
	if l[i] == 1:
		print('NO')
	elif ceil(x) == floor(x):
		y = floor(x)
		f = 0
		for j in range(2, int(sqrt(y)) + 1):
			if y % j == 0:
				f = 1
				break
		if f == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


X = 10 ** 6
prime = [1] * (X + 1)
(prime[0], prime[1]) = (0, 0)
i = 2
while i * i <= X:
	if prime[i] == 1:
		j = i
		while j <= X / i:
			prime[i * j] = 0
			j += 1
	i += 1
n = int(input())
narr = list(map(int, input().split()))
for p in narr:
	root = int(p ** 0.5)
	if root * root == p:
		if prime[root] == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


MAX = 10 ** 6
prime = [True] * (MAX + 1)
prime[0] = prime[1] = False
for i in range(2, int(MAX ** 0.5)):
	if prime[i] == True:
		for j in range(i * i, len(prime), i):
			prime[j] = False
n = int(input())
nums = list(map(int, input().split()))
for i in nums:
	x = i ** 0.5
	if x.is_integer():
		if prime[int(x)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from sys import stdin as inp
from sys import stdout as out
from math import sqrt
a = lambda : list(map(int, inp.readline().split()))
m = pow(10, 6)
b = [True] * (m + 1)

def check(x):
	l = 1
	h = x
	ans = 1
	while l <= h:
		m = (l + h) // 2
		if m * m <= x:
			ans = m
			l = m + 1
		else:
			h = m - 1
	if ans * ans == x and b[ans]:
		return 'YES'
	return 'NO'

def seive():
	b[0] = False
	b[1] = False
	l = int(sqrt(m)) + 1
	for i in range(2, l):
		if b[i]:
			for j in range(i * i, m + 1, i):
				b[j] = False
seive()
n = a()[0]
l = a()
for i in l:
	out.write(check(i) + '\n')


def get_prime(n):
	if n == 2:
		return [2]
	else:
		prime_sqrt_n = get_prime(int((n - 1) ** 0.5) + 1)
		is_prime = [1] * (n - 1)
		for p in prime_sqrt_n:
			q = p
			while q < n // p + 1:
				is_prime[p * q - 2] = 0
				q += 1
		return [i for (i, j) in enumerate(is_prime, start=2) if j == 1]
prime_min = get_prime(10 ** 3)
input()
t_list = [*map(int, input().split())]
for squared_t in t_list:
	if squared_t == 1:
		print('NO')
		continue
	t = int(squared_t ** 0.5)
	if t ** 2 != squared_t:
		print('NO')
		continue
	sqrt_t = int(t ** 0.5)
	j = 0
	prime = True
	while prime_min[j] <= sqrt_t:
		if t % prime_min[j] == 0:
			print('NO')
			prime = False
			break
		if j < len(prime_min) - 1:
			j += 1
		else:
			break
	if prime:
		print('YES')


limit = 1000001
a = [True] * limit
a[0] = a[1] = False
for (i, isprime) in enumerate(a):
	if isprime:
		for n in range(i * i, limit, i):
			a[n] = False
n = int(input())
b = list(map(int, input().split(' ')))
for i in b:
	print('YES') if a[int(i ** 0.5)] and int(i ** 0.5) * int(i ** 0.5) == i else print('NO')


def sqr(x):
	root = int(x ** 0.5) - 1
	for _ in range(3):
		if root * root == x:
			return root
		root += 1
	return -1
n = int(input())
a = list(map(int, input().split()))
num = 1000001
aux = [1] * num
aux[0] = 0
aux[1] = 0
for i in range(2, 1001):
	if aux[i] == 1:
		for j in range(i * i, num, i):
			aux[j] = 0
for e in a:
	root = sqr(e)
	if root != -1 and aux[root]:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
s = list(map(int, input().split()))
sp = [0, 0] + [1] * (10 ** 6 - 1)

def suuu_generator(n, sp):
	p = 2
	while p * p <= n:
		if sp[p]:
			for i in range(p * 2, n + 1, p):
				sp[i] = 0
		p += 1
suuu_generator(10 ** 6, sp)
for ss in s:
	sq = int(math.sqrt(ss))
	if sq ** 2 == ss and sp[sq]:
		print('YES')
	else:
		print('NO')


import math
rangeOfNum = 1000000
primes = []
sieve = [True] * (rangeOfNum + 1)
sieve[0] = False
sieve[1] = False
p = 2
while p * p <= rangeOfNum:
	if sieve[p] == True:
		for i in range(p + p, rangeOfNum + 1, p):
			sieve[i] = False
	p += 1
n = int(input())
for num in input().split():
	root = math.sqrt(int(num))
	if int(root + 0.5) ** 2 == int(num):
		root = int(root)
		if sieve[root] == False:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


import math
n = int(input())
arr = [int(i) for i in input().split()]
for i in arr:
	if i == 1 or i == 2 or i == 3:
		print('NO')
		continue
	c = 0
	a = int(math.sqrt(i))
	if a * a == i:
		b = int(math.sqrt(a))
		if b * b == a:
			print('NO')
			continue
		else:
			for j in range(2, b + 1):
				if a % j == 0:
					c = 1
					break
			if c == 0:
				print('YES')
			else:
				print('NO')
	else:
		print('NO')


prime = [True for i in range(10 ** 6 + 1)]
p = 2
while p * p <= 10 ** 6:
	if prime[p] == True:
		for i in range(p * p, 10 ** 6 + 1, p):
			prime[i] = False
	p += 1
n = int(input())
a = list(map(int, input().split()))
for i in a:
	b = i ** 0.5
	if b == 1:
		print('NO')
	elif b == int(b):
		if prime[int(b)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from __future__ import division, print_function
from sys import stdin, stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
from fractions import Fraction

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = defaultdict(list)
	for i in range(e):
		(x, y) = mi()
		d[x].append(y)
		d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def Prime(x):
	if x < 2:
		return False
	for i in range(2, int(sqrt(x)) + 1):
		if x % i == 0:
			return False
	return True
n = ii()
l = li()
k = int(1000000.0 + 2)
sieve = [True] * k
sieve[1] = sieve[0] = False
for i in range(2, k):
	if sieve[i] == True:
		for j in range(i * i, k, i):
			sieve[j] = False
for i in l:
	if int(i ** 0.5) == i ** 0.5 and sieve[int(i ** 0.5)] == True:
		print('YES')
	else:
		print('NO')


n = int(input())
a = [int(x) for x in input().split()]
m = max(a)
m1 = int(m ** (1 / 2)) + 1
s = [True] * m1
p = 2
while p * 2 < m1:
	if s[p]:
		for i in range(p * 2, m1, p):
			s[i] = False
	p += 1
s[1] = False
for i in range(n):
	b = a[i] ** (1 / 2)
	if b == int(b):
		if s[int(b)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


prime = [1 for i in range(1000005)]
prime[1] = 0

def sieve(n=1000000):
	i = 2
	while i * i <= n:
		if prime[i] == 1:
			j = i * i
			while j <= n:
				prime[j] = 0
				j += i
		i += 1
sieve()
n = int(input())
ls = [int(x) for x in input().split()]
for x in ls:
	y = int(x ** 0.5)
	if y * y == x and prime[y] == 1:
		print('YES')
	else:
		print('NO')


def eratosthenes(n):
	t = [True] * (n + 1)
	for i in range(2, n + 1):
		if not t[i]:
			continue
		for j in range(i * i, n + 1, i):
			t[j] = False
	return [i for i in range(2, n) if t[i]]
primes = eratosthenes(1000000)
p = set((i * i for i in primes))
n = int(input())
for i in input().split():
	print('YES' if int(i) in p else 'NO')


from math import sqrt

def get_int():
	from sys import stdin
	return int(stdin.readline().replace('\n', ''))

def get_int_list():
	from sys import stdin
	return [int(x) for x in stdin.readline().replace('\n', '').split(' ')]

def isqrt(n):
	sqrt = int(n ** 0.5) - 1
	if sqrt ** 2 == n:
		return sqrt
	sqrt += 1
	if sqrt ** 2 == n:
		return sqrt
	sqrt += 1
	if sqrt ** 2 == n:
		return sqrt
	return -1

def sieve_of_eratosthenes(n):
	primes = [True for i in range(n + 1)]
	p = 2
	while p ** 2 <= n:
		if primes[p] == True:
			for i in range(p ** 2, n + 1, p):
				primes[i] = False
		p += 1
	return primes

def is_prime(n, primes=[]):
	return primes[n]

def is_tprime(n, sieve):
	rt = isqrt(n)
	return 'YES' if n > 1 and rt != -1 and is_prime(rt, sieve) else 'NO'
n = get_int()
_list = get_int_list()
max_list = max(_list)
sieve = sieve_of_eratosthenes(int(sqrt(max_list)) + 5)
for i in _list:
	print(is_tprime(i, sieve))


input()
a = list(map(int, input().split()))
N = round(max(a) ** 0.5) + 1
sieve = [0] + [1] * (N // 2 + 1)
for j in range(1, N // 2 + 1):
	if sieve[j]:
		p = 2 * j + 1
		for i in range(p * p, N, 2 * p):
			sieve[i // 2] = 0
for v in a:
	r = round(v ** 0.5)
	if r * r == v:
		if sieve[r // 2] and (r % 2 or r == 2):
			print('YES')
			continue
	print('NO')


def oula(r):
	prime = [0 for i in range(r + 1)]
	common = []
	for i in range(2, r + 1):
		if prime[i] == 0:
			common.append(i)
		for j in common:
			if i * j > r:
				break
			prime[i * j] = 1
			if i % j == 0:
				break
	return prime
s = oula(1000000)
n = int(input())
for number in map(int, input().split()):
	if number < 4 or int(number ** 0.5) != number ** 0.5:
		print('NO')
	elif s[int(number ** 0.5)] == 0:
		print('YES')
	else:
		print('NO')


n = input()
maxn = 10 ** 6 + 1
tprimes = []
tester = [True] * maxn
for i in range(2, maxn):
	if tester[i]:
		tprimes.append(i ** 2)
		for j in range(i + i, maxn, i):
			tester[j] = False
tprimes = set(tprimes)
for k in map(int, input().split()):
	if k in tprimes:
		print('YES')
	else:
		print('NO')


import math
input()
nums = list(map(int, input().split()))

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	p_set = set()
	for p in range(n + 1):
		if prime[p]:
			p_set.add(p)
	return p_set
big_p = SieveOfEratosthenes(int(math.sqrt(sorted(nums)[-1])))

def is_prime(n):
	return n in big_p
for num in nums:
	prime = True
	sqrt = math.sqrt(num)
	if sqrt % 1 != 0:
		prime = False
	if prime and sqrt < 2:
		prime = False
	if prime and (not is_prime(int(sqrt))):
		prime = False
	if prime:
		print('YES')
	else:
		print('NO')


import math

def isprime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, math.floor(math.sqrt(n)) + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	for i in arr:
		sq = math.floor(math.sqrt(i))
		if 1 * sq * sq == i and isprime(sq):
			print('YES')
		else:
			print('NO')
n = int(input())
arr = list(map(int, input().split()))
solve()


lim = 10 ** 6 + 1
good = set()
prime = [True] * lim
prime[1] = 0
for i in range(2, lim):
	if prime[i] == True:
		for j in range(i ** 2, lim, i):
			prime[j] = False
		good.add(i ** 2)
n = int(input())
x = map(int, input().split())
for i in x:
	if i in good:
		print('YES')
	else:
		print('NO')


def main():
	input()
	tt = {4}
	l = list(map(int, input().split()))
	lim2 = 500002
	sieve = [True] * lim2
	for i in range(lim2 // 3 + 1):
		if sieve[i]:
			(p, pp) = (2 * i + 3, (i + 3) * i * 2 + 3)
			sieve[pp::p] = [False for _ in range(pp, lim2, p)]
	for (i, f) in enumerate(sieve):
		if f:
			i += i + 3
			tt.add(i * i)
	for x in l:
		print(('NO', 'YES')[x in tt])
main()


prime = [True for i in range(10 ** 6 + 1)]
p = 2
while p * p <= 10 ** 6:
	if prime[p]:
		for i in range(p * p, 10 ** 6 + 1, p):
			prime[i] = False
	p += 1
(prime[0], prime[1]) = (False, False)
n = int(input())
l = list(map(int, input().split()))
for i in l:
	if prime[int(i ** 0.5)] and i % i ** 0.5 == 0:
		print('YES')
	else:
		print('NO')


x = int(input())
y = [int(a) for a in input().split()]
from math import sqrt

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	k = int(sqrt(n)) + 1
	for i in range(5, k, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def isThreeDisctFactors(n):
	sq = int(sqrt(n))
	if 1 * sq * sq != n:
		return False
	if isPrime(sq):
		return True
	else:
		return False
for i in y:
	if isThreeDisctFactors(i):
		print('YES')
	else:
		print('NO')


import math
prime = [True for i in range(1000005)]
prime[1] = False
for i in range(2, 1000001):
	if prime[i]:
		for j in range(i + i, 1000001, i):
			prime[j] = False
n = int(input())
a = list(map(int, input().split()))
for i in a:
	x = round(math.sqrt(i))
	if x * x == i and prime[x]:
		print('YES')
	else:
		print('NO')


import math
n = 1000001
p = [1] * n
p[0] = p[1] = 0
for i in range(2, 1001):
	if p[i]:
		for j in range(i + i, n, i):
			p[j] = 0
input()
x = list(map(int, input().split()))
for i in x:
	if p[int(i ** 0.5)] and int(i ** 0.5) * int(i ** 0.5) == i:
		print('YES')
	else:
		print('NO')


from math import sqrt
n = int(input())
l = list(map(int, input().split()))
size = 10 ** 6
is_prime = [True] * (size + 1)
is_prime[1] = 0
aux = []
for i in range(2, size):
	if is_prime[i] == 1:
		aux.append(i)
	for j in aux:
		if j * i > size:
			break
		is_prime[i * j] = 0
		if i % j == 0:
			break
for i in l:
	temp = sqrt(i)
	if int(temp) * int(temp) != i:
		print('NO')
	elif is_prime[int(temp)] == 1:
		print('YES')
	else:
		print('NO')


import math

def tPrime(arr):
	k = max(arr)
	k = math.sqrt(k)
	k = int(k)
	mat = [1] * (k + 1)
	mat[1] = 0
	for i in range(2, len(mat)):
		if mat[i] == 0:
			continue
		p = 2
		while p * i <= len(mat) - 1:
			mat[p * i] = 0
			p += 1
	for i in arr:
		k = math.sqrt(i)
		if k == int(k):
			if mat[int(k)] == 1:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
n = int(input())
arr = list(map(int, input().split()))
tPrime(arr)


def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	arr = set()
	for i in range(2, n):
		if prime[i]:
			arr.add(i ** 2)
	return arr

def main():
	n = int(input())
	valid = SieveOfEratosthenes(int(1000000.0))
	ans = map(int, input().split())
	for i in ans:
		if i in valid:
			print('YES')
		else:
			print('NO')
main()


def pr(n, prime):
	p = 2
	while p ** 2 <= n:
		if prime[p] == True:
			for i in range(2 * p, n + 1, p):
				prime[i] = False
		p += 1
n = int(input())
prime = [True] * (10 ** 6 + 10)
pr(10 ** 6 + 1, prime)
a = [int(x) for x in input().split()]
for i in a:
	b = int(i ** 0.5)
	if i ** 0.5 - b != 0 or i < 4:
		print('NO')
		continue
	elif prime[b] == True:
		print('YES')
	else:
		print('NO')


input()
l = 1000001
sieve = [0, 0] + [1] * l
for i in range(2, l):
	if sieve[i]:
		for j in range(i * i, l, i):
			sieve[j] = 0
for k in input().split():
	n = int(k)
	sqrt = int(n ** 0.5)
	print('YNEOS'[sqrt ** 2 != n or 1 - sieve[sqrt]::2])


n = int(input())
a = list(map(int, input().split()))
MAXN = 10 ** 6 + 5
p = [True] * (MAXN + 1)
memo = {}
for i in range(2, MAXN):
	if p[i]:
		memo[i * i] = 1
		for j in range(2 * i, MAXN, i):
			p[j] = False
for i in a:
	if i in memo:
		print('YES')
	else:
		print('NO')


import math
se = [0] * 1000001
se[0] = 1
se[1] = 1
for i in range(2, 1000001):
	if se[i] == 0:
		for j in range(i * i, 1000001, i):
			se[j] = 1
n = int(input())
li = list(map(int, input().split(' ', n)[:n]))
ans = []
for i in range(n):
	if math.sqrt(li[i]) == int(math.sqrt(li[i])) and se[int(math.sqrt(li[i]))] == 0:
		ans.append('YES')
	else:
		ans.append('NO')
for i in range(n):
	print(ans[i])


from sys import stdin, stdout
(read, write) = (stdin.readline, stdout.write)
prime = [1] * 1000001

def sq_root(x):
	root = int(x ** 0.5) - 1
	if root * root == x:
		return root
	root += 1
	if root * root == x:
		return root
	root += 1
	if root * root == x:
		return root
	return -1
prime[0] = prime[1] = 0
for i in range(2, 1001):
	if prime[i] == 1:
		for j in range(i * i, 1000001, i):
			prime[j] = 0
n = int(input())
numbers = map(int, read().split())
for i in numbers:
	root = sq_root(i)
	if root != -1 and prime[root]:
		write('YES\n')
	else:
		write('NO\n')


from sys import stdin
import math
n = int(stdin.readline().rstrip())
l = list(map(int, stdin.readline().split()))
k = [math.sqrt(x) for x in l]
for i in k:
	if i == 1:
		print('NO')
	elif math.ceil(i) - i == 0.0:
		flag = 0
		x = int(math.ceil(math.sqrt(int(i))))
		for j in range(2, x + 1):
			if int(i) % j == 0 and j != int(i):
				flag = 1
		if flag == 1:
			print('NO')
		elif int(i) == 2:
			print('YES')
		else:
			print('YES')
	else:
		print('NO')


arr = [True for i in range(1000000)]
arr[0] = False
arr[1] = False
arr[2] = True
i = 2
n = 10 ** 6
while i * i <= n:
	if arr[i]:
		for j in range(i * i, n, i):
			arr[j] = False
	i += 1
myset = set()
for i in range(len(arr)):
	if arr[i]:
		myset.add(i * i)
n = int(input())
lst = list(map(int, input().split()))
for val in lst:
	if val in myset:
		print('YES')
	else:
		print('NO')


def isPrime(n):
	if n < 2:
		return False
	for i in range(2, 1 + int(n ** 0.5)):
		if n % i:
			continue
		return False
	return True
n = int(input())
s = [int(i) for i in input().split()]
for i in s:
	root = int(i ** 0.5)
	if i == root * root:
		if isPrime(root):
			print('YES')
			continue
	print('NO')


from math import sqrt
lt = [True] * 1000001
n = 1000000
x = 2
while x ** 2 <= n:
	if lt[x]:
		for a in range(2 * x, n + 1, x):
			lt[a] = False
	x += 1
z = int(input())
lt1 = [int(a) for a in input().split()]
for i in range(z):
	z = lt1[i]
	if z == 1:
		print('NO')
	elif sqrt(z) % 1 == 0:
		if lt[int(sqrt(z))]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda : map(int, stdstr().split())
mod = 1000000007
p = [False] * (10 ** 6 + 2)
for i in range(2, 10 ** 6 + 1):
	if p[i] == True:
		continue
	for j in range(i + i, 10 ** 6 + 1, i):
		p[j] = True
n = stdint()
arr = list(stdarr())
for i in arr:
	if i == 1:
		print('NO')
		continue
	sq = sqrt(i)
	if sq % 1 == 0 and p[int(sq)] == False:
		print('YES')
	else:
		print('NO')


input()
lis = list(map(int, input().split()))
prime = [1] * 2 + [0] * 1000000
for i in range(2, 1001):
	if prime[i] == 0:
		for j in range(i * i, 1000001, i):
			prime[j] = 1
for e in lis:
	print(('NO', 'YES')[prime[int(e ** 0.5)] == 0 and int(e ** 0.5) ** 2 == e])


from math import *
import sys
input = sys.stdin.readline
prime = [True for i in range(10 ** 6 + 2)]

def siv(n):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
siv(10 ** 6 + 1)
n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	flag = 2
	if int(sqrt(a[i])) == int(ceil(sqrt(a[i]))):
		flag += 1
	print('YES' if flag == 3 and a[i] != 1 and prime[int(sqrt(a[i]))] else 'NO')


def main():
	import sys
	import bisect
	C = int(1000000.0)
	l = []
	for i in range(C):
		l.append(True)
	for i in range(3, C, 2):
		if l[i - 1]:
			j = 3 * i
			while j <= C:
				l[j - 1] = False
				j += 2 * i
	for i in range(3, C, 2):
		l[i] = False
	l[0] = False
	s = []
	for i in range(C):
		if l[i]:
			s.append((i + 1) * (i + 1))
	n = int(sys.stdin.readline())
	tup = tuple(map(int, sys.stdin.readline().split()))
	for i in tup:
		pos = bisect.bisect_left(s, i)
		if pos != len(s) and s[pos] == i:
			sys.stdout.write('YES\n')
		else:
			sys.stdout.write('NO\n')
main()


def main():
	l = ['NO'] * int(input())
	sieve = bytearray(b'\x00\x00\x01\x00\x01\x01\x00\x01\x01\x00\x01\x00\x00\x01\x01') * 33334
	for (b, p) in zip(sieve, range(3, 1001, 2)):
		if b:
			pp = (p * p - 3) // 2
			sieve[pp::p] = b'\x00' * ((500009 - pp) // p + 1)
	tt = {(i * 2 + 3) ** 2 for (i, f) in enumerate(sieve) if f}
	tt.update((4, 9, 25))
	for (i, x) in enumerate(map(int, input().split())):
		if x in tt:
			l[i] = 'YES'
	print('\n'.join(l))
main()


n = int(input())
x = list(map(int, input().split()))
y = 10 ** 6
l = [1] * y
l[0] = 0
l[1] = 0
m = set()
for i in range(2, y):
	if l[i] == 1:
		m.add(i ** 2)
		for j in range(i * 2, y, i):
			l[j] = 0
for k in x:
	if k in m:
		print('YES')
	else:
		print('NO')


t = int(input())
a = list(map(int, input().split()))
n = 10 ** 6 + 1
prime = [True] * n
p = 2
while p * p <= n:
	if prime[p]:
		for i in range(p * p, n, p):
			prime[i] = False
	p += 1
import math
for i in range(t):
	m = math.sqrt(a[i])
	if m.is_integer() and m != 1 and prime[int(m)]:
		print('YES')
	else:
		print('NO')


n = int(input())
s = list(map(int, input().split()))
from math import sqrt, ceil

def isprime(a):
	bo = 1
	if a == 2:
		bo = 1
	else:
		for i in range(2, ceil(sqrt(a)) + 1):
			if a % i == 0:
				bo = 0
	if bo == 1:
		return True
	else:
		return False
for i in range(n):
	if s[i] != 1:
		if int(sqrt(s[i])) ** 2 == s[i]:
			if isprime(int(sqrt(s[i]))):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


import math

def prime_flagging():
	limit = 1000002
	prime_flag = [True] * limit
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, limit):
		if prime_flag[i] == True:
			for j in range(i * i, limit, i):
				prime_flag[j] = False
	return prime_flag

def isPerfectSquare(x):
	sr = math.sqrt(x)
	return sr - math.floor(sr) == 0
prime_flag = prime_flagging()
n = int(input())
numbers = input().split(' ')
numbers = list(map(int, numbers))
for i in numbers:
	if isPerfectSquare(i) == True:
		if prime_flag[int(math.sqrt(i))] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


MAXN = 1000001
sq = set()
pr = [1] * MAXN
for i in range(2, MAXN):
	if pr[i] == 1:
		for j in range(i * i, MAXN, i):
			pr[j] = 0
		sq.add(i * i)
n = int(input())
for i in map(int, input().split()):
	if i in sq:
		print('YES')
	else:
		print('NO')


def getPrimes(n):
	sieve = [True] * (n // 2)
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i // 2]:
			sieve[i * i // 2::i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	d = {}
	d[4] = True
	for j in [2 * i + 1 for i in range(1, n // 2) if sieve[i]]:
		d[j * j] = True
	return d
n = int(input())
a = input().split()
d = getPrimes(10 ** 6)
for i in a:
	if int(i) in d:
		print('YES')
	else:
		print('NO')


import math

def primecheck(num):
	if num == 1:
		return 0
	count = 0
	if num % 2 == 0:
		num = num / 2
		count = count + 1
	i = 3
	while i <= int(math.sqrt(num)):
		if num % i == 0:
			num = num / i
			count = count + 1
		i = i + 2
	if count > 1 or (count == 1 and num != 1):
		return 0
	else:
		return 1
count = int(input(''))
nums = [int(i) for i in input('').split(' ')]
for i in range(count):
	if int(pow(int(math.sqrt(nums[i])), 2)) == nums[i] and primecheck(int(math.sqrt(nums[i]))):
		print('YES')
	else:
		print('NO')


import math as m
MAX = 1100000
primes = []
mark = [False] * MAX
mark[0] = mark[1] = True
n = int(input())
ls = [int(i) for i in input().split()]
for i in range(2, MAX):
	if mark[i] == True:
		continue
	primes.append(i)
	for j in range(2 * i, MAX, i):
		mark[j] = True
for i in ls:
	if mark[int(m.sqrt(i))] == False and int(m.sqrt(i)) ** 2 == i:
		print('YES')
	else:
		print('NO')


import sys

def S(n):
	prime = [True for i in range(n + 1)]
	prime[1] = False
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	return prime
input = sys.stdin.readline
print = sys.stdout.write
n = int(input())
l = list(map(int, input().split()))
r = S(1000000)
for i in range(n):
	k = l[i] ** 0.5
	if int(k) == k:
		if r[int(k)]:
			print('YES' + '\n')
		else:
			print('NO' + '\n')
	else:
		print('NO' + '\n')


prime = [1] * (10 ** 6 + 1)

def sie_era(n):
	p = 2
	while p ** 2 <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = 0
		p += 1
ans = []
_ = input()
n = list(map(int, input().split()))
sie_era(10 ** 6)
for i in n:
	key = False
	if i < 4:
		ans.append('NO')
		continue
	elif int(i ** 0.5) ** 2 != i:
		ans.append('NO')
		continue
	ans.append(['NO', 'YES'][prime[int(i ** 0.5)]])
print('\n'.join(ans))


def sieve(n):
	np1 = n + 1
	s = list(range(np1))
	s[1] = 0
	sqrtn = int(round(n ** 0.5))
	for i in range(2, sqrtn + 1):
		if s[i]:
			s[i * i:np1:i] = [0] * len(range(i * i, np1, i))
	return filter(None, s)
n = int(input())
listOfNum = [int(i) for i in input().split()]
prime = set(sieve(int(max(listOfNum) ** 0.5) + 1))
for item in listOfNum:
	s = item ** 0.5
	if int(s) == s and s in prime:
		print('YES')
	else:
		print('NO')


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def tPrimos():
	TOPE_CRIBA = 1000000
	cribaArray = [True] * TOPE_CRIBA
	cribaArray[0] = cribaArray[1] = False
	for p in range(TOPE_CRIBA):
		if cribaArray[p]:
			for j in range(p * p, TOPE_CRIBA, p):
				cribaArray[j] = False
	return set((p * p for p in range(TOPE_CRIBA) if cribaArray[p]))

def solve():
	yesSet = tPrimos()
	n = int(input())
	for number in map(int, input().split()):
		if number in yesSet:
			print('YES')
		else:
			print('NO')
solve()


n = 1000000
coada = set()
prim = [1] * n
prim[0] = 0
prim[1] = 0
for (i, j) in enumerate(prim):
	if j != 0:
		coada.add(i * i)
		for k in range(i + i, n, i):
			prim[k] = 0
nr = int(input())
numbers = map(int, input().split(' '))
for i in numbers:
	if i in coada:
		print('YES')
	else:
		print('NO')


def seive():
	s = 1000002
	primes = [True] * s
	primes[0] = False
	primes[1] = False
	for i in range(2, int(s ** 0.5) + 1):
		if primes[i]:
			j = i * i
			while j < s:
				primes[j] = False
				j += i
	return primes
primes = seive()
t = int(input())
a = list(map(int, input().split()))
for i in a:
	s = i ** 0.5
	if int(s) == s:
		if primes[int(s)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


primes = [True] * (10 ** 6 + 1)
for i in range(1, 10 ** 6 + 1):
	if primes[i] == False:
		continue
	elif i < 2:
		primes[i] = False
		continue
	else:
		for j in range(2 * i, 10 ** 6 + 1, i):
			primes[j] = False
t = int(input())
array = list(map(int, input().split(' ')))
for x in array:
	if x ** (1 / 2) == int(x ** (1 / 2)):
		if primes[int(x ** (1 / 2))]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
from typing import List, Tuple, Set

def parse_input() -> Tuple[int, List[int]]:
	return (int(input()), [int(x) for x in input().split()])

def find_primes(bound: int) -> Set[int]:
	sieve = [0, 0] + [1] * (bound - 2)
	bound_root = int(math.sqrt(bound)) + 1
	for i in range(2, bound_root):
		if sieve[i]:
			for j in range(i * i, bound, i):
				sieve[j] = 0
	return set([idx for (idx, x) in enumerate(sieve) if x])

def solve(xs: List[int]) -> List[str]:
	max_root = int(math.sqrt(max(xs))) + 1
	primes = find_primes(max_root)
	answer = []
	for x in xs:
		root = math.sqrt(x)
		if x % root == 0 and root in primes:
			answer.append('YES')
		else:
			answer.append('NO')
	return answer
(_, xs) = parse_input()
for elem in solve(xs):
	print(elem)


import math
le = 10 ** 6 + 2
c = [1, 1] + [0] * le
for i in range(2, le):
	if 1 - c[i]:
		for j in range(i * i, le, i):
			c[j] = 1
n = int(input())
ls = [int(x) for x in input().split()]
for num in ls:
	sq = int(num ** 0.5)
	if sq * sq == num and (not c[sq]):
		print('YES')
	else:
		print('NO')


import math
prime = [True for i in range(10 ** 6 + 1)]

def SieveOfEratosthenes(n):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
n = input()
inp = list(map(int, input().split()))
SieveOfEratosthenes(int(math.sqrt(max(inp))))
for i in range(len(inp)):
	if inp[i] == 1:
		print('NO')
		continue
	if int(math.sqrt(inp[i])) ** 2 == inp[i] and prime[int(math.sqrt(inp[i]))]:
		print('YES')
	else:
		print('NO')


import math
from sys import stdin, stdout
n = int(stdin.readline())
l = list(map(int, stdin.readline().split()))
d = {}
prime = [i for i in range(1000001)]
p = 2
while p * p <= 1000001:
	if prime[p]:
		for i in range(p * p, 1000001, p):
			prime[i] = False
	p += 1
for i in range(2, 1000001):
	if prime[i]:
		d[i * i] = 1
for i in l:
	if i in d:
		print('YES')
	else:
		print('NO')


from math import *
n = int(input())
li1 = list(map(int, input().split()))
n = 10 ** 6 + 1
mark = [0] * n
mark[0] = 1
mark[1] = 1
p = 2
while p * p <= n:
	if mark[p] == 0:
		for j in range(p * p, n, p):
			mark[j] = 1
	p += 1
for i in li1:
	if floor(sqrt(i)) == ceil(sqrt(i)) and mark[int(sqrt(i))] == 0:
		print('YES')
	else:
		print('NO')


def get_primes(n):
	primes = [1] * (n + 1)
	primes[0] = primes[1] = 0
	i = 2
	while i * i <= n:
		if primes[i]:
			primes[i * i:n + 1:i] = [0] * (int((n - i * i) / i) + 1)
		i += 1
	return primes
primes = get_primes(1000000)
n = input()
nums = map(int, input().split())
for num in nums:
	prime = int(num ** 0.5)
	print('YES' if prime ** 2 == num and primes[prime] else 'NO')


import bisect

def soe():
	n = 1000000
	i = 2
	prime = [True] * (n + 1)
	while i * i <= n:
		if prime[i]:
			for j in range(i * i, n + 1, i):
				prime[j] = False
		i += 1
	l = []
	i = 2
	while i <= n:
		if prime[i]:
			l.append(i * i)
		i += 1
	return l
x = soe()
n = int(input())
l = list(map(int, input().split()))
for i in l:
	a = bisect.bisect_left(x, i)
	if a == len(x):
		a -= 1
	if x[a] == i:
		print('YES')
	else:
		print('NO')


from sys import stdin
import math
a = int(stdin.readline())
A = stdin.readline().split()
for k in range(0, a):
	Q = 0
	if int(A[k]) == 1 or int(A[k]) == 3:
		print('NO')
		continue
	if math.floor(math.sqrt(int(A[k]))) == math.sqrt(int(A[k])):
		B = int(math.sqrt(int(A[k])))
		for k in range(2, math.floor(math.sqrt(B)) + 1):
			if B % k == 0:
				print('NO')
				Q = 1
				break
	else:
		print('NO')
		Q = 1
	if Q == 0:
		print('YES')


n = int(input())
a = list(map(int, input().split()))
sieve = [True] * 1000001
p = 2
while p * p <= 1000000:
	if sieve[p]:
		for i in range(p * p, 1000001, p):
			sieve[i] = False
	p += 1
tPrimes = set()
for i in range(2, 1000001):
	if sieve[i]:
		tPrimes.add(i * i)
for x in a:
	if x in tPrimes:
		print('YES')
	else:
		print('NO')


def eratosthenes(limit):
	a = list(range(limit + 1))
	for i in range(2, int(limit ** 0.5) + 1):
		if a[i] != 0:
			for j in range(i ** 2, limit + 1, i):
				a[j] = 0
	return [i for i in a[2:] if i > 0]
primes = eratosthenes(1000000)
q = set((i ** 2 for i in primes))
n = int(input())
x = list(map(int, input().split()))
for i in x:
	print('YES' if i in q else 'NO')


def SieveOfEratosthenes(n):
	c = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n):
		if prime[p]:
			c.append(p)
	return c
d = {}
c = [pow(i, 2) for i in SieveOfEratosthenes(1000000)]
for i in range(len(c)):
	d[c[i]] = 1
n = int(input())
a = list(map(int, input().split()))
for i in range(len(a)):
	try:
		if d[a[i]] == 1:
			print('YES')
	except:
		print('NO')


import math
n = 1000000
a = [False] * (n + 1)
m = int(math.sqrt(n)) + 1
for i in range(2, m + 1):
	if a[i] == True:
		continue
	for k in range(i * i, n + 1, i):
		a[k] = True
s = set()
for i in range(2, n + 1):
	if a[i] == False:
		s.add(i * i)
n = int(input())
x = list(map(int, input().split()))
for t in x:
	if t in s:
		print('YES')
	else:
		print('NO')


(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, dgraphs, mod) = (lambda : sorted(zz()), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
s = [True] * 1000001
(s[0], s[1]) = (False, False)
for i in range(2, 1000001):
	if s[i]:
		for j in range(i * i, 1000001, i):
			s[j] = False
t = int(z())
l = zz()
for i in l:
	a = int(i ** 0.5)
	if a * a == i and s[a]:
		print('YES')
	else:
		print('NO')


import math

def sieve(n):
	isPrime = [True] * (n + 1)
	isPrime[1] = False
	i = 2
	while i * i <= n:
		if isPrime[i] == True:
			for j in range(i * i, n + 1, i):
				isPrime[j] = False
		i += 1
	return isPrime

def main():
	n = int(input())
	l = list(map(int, input().split()))
	arr = sieve(1000000)
	for i in range(n):
		number = math.sqrt(l[i])
		if number.is_integer():
			if arr[int(number)]:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
main()


import math

def divisors(n):
	t = int(math.sqrt(n))
	if t * t == n:
		i = 2
		r = int(math.sqrt(t))
		temp = 0
		while i <= r:
			if t % i == 0:
				temp = 1
				break
			i += 1
		if temp == 0:
			return 'YES'
		else:
			return 'NO'
	else:
		return 'NO'
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
	dic = {}
	if A[i] == 1:
		print('NO')
	else:
		print(divisors(A[i]))


n = int(input())

def SOE(n):
	l = 2 * [False] + (n - 1) * [True]
	for i in range(2, int(n ** 0.5) + 1):
		for j in range(i * i, n + 1, i):
			l[j] = False
	return l
primes = SOE(10 ** 6)
for i in map(int, input().split()):
	if int(i ** 0.5) == float(i ** 0.5):
		if primes[int(i ** 0.5)] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def test3prime(n):
	if n == 1:
		return False
	q = int(round(math.sqrt(n)))
	if q * q != n:
		return False
	else:
		i = 2
		while i * i <= q:
			if q % i == 0:
				return False
			i = i + 1
		return True
input()
l = invr()
for i in l:
	if test3prime(i):
		print('YES')
	else:
		print('NO')


import math
n = int(input())
a = list(map(int, input().split()))

def isPrime(n):
	if n < 2:
		return False
	if n == 2 or n == 3:
		return True
	m = math.sqrt(n)
	if n % 2 == 0:
		return False
	for i in range(3, int(m) + 2, 2):
		if n % i == 0:
			return False
	return True
for ele in a:
	root = math.sqrt(ele)
	f = math.floor(root)
	c = math.ceil(root)
	if c == f:
		if isPrime(f):
			print('YES')
			continue
	print('NO')


from math import sqrt
import math

def Prime():
	primo = []
	for i in range(1000100):
		primo.append(True)
	primo[0] = False
	primo[1] = False
	for i in range(2, int(sqrt(1000100)) + 1):
		if primo[i]:
			for j in range(i * i, 1000100, i):
				primo[j] = False
	return primo
n = int(input())
l = list(map(int, input().split(None, n)[:n]))
primo = Prime()
for i in l:
	m = sqrt(i)
	k = math.fmod(m, int(m))
	if k == 0:
		if primo[int(m)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
T = int(input())
arr = input().split()
arr = [int(x) for x in arr]
p = SieveOfEratosthenes(1000000)
for i in arr:
	if int(math.sqrt(i)) ** 2 == i:
		if i == 1:
			print('NO')
		elif p[int(math.sqrt(i))]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
y = int(input())
x = map(int, input().split())

def sieve(n=1000000):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	return prime
li_c = sieve()

def radicals(c):
	p = math.sqrt(c)
	if p == int(p) and li_c[int(p)] == True:
		return True
	else:
		return False
for i in x:
	if i == 1:
		print('NO')
	elif radicals(i):
		print('YES')
	else:
		print('NO')


n = 1000000
List = [1] * n
List[0] = 0
List[1] = 0
out = set()
for i in range(n):
	if List[i] != 0:
		out.add(i * i)
		for j in range(i * 2, n, i):
			List[j] = 0
t = input()
C = list(map(int, input().split()))
for i in C:
	if i in out:
		print('YES')
	else:
		print('NO')


temp = [True for i in range(10 ** 6 + 1)]
temp[0] = False
temp[1] = False
for i in range(10 ** 6 + 1):
	if temp[i] == True:
		for j in range(i * i, 10 ** 6 + 1, i):
			temp[j] = False
n = int(input())
arr = [int(x) for x in input().split()]
for i in arr:
	if int(i ** 0.5) == i ** 0.5:
		if temp[int(i ** 0.5)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
a = map(int, input().split())

def sieve_for_primes_to(n):
	size = n // 2
	sieve = [1] * size
	limit = int(n ** 0.5)
	for i in range(1, limit):
		if sieve[i]:
			val = 2 * i + 1
			tmp = (size - 1 - i) // val
			sieve[i + val::val] = [0] * tmp
	return [2] + [i * 2 + 1 for (i, v) in enumerate(sieve) if v and i > 0]
from math import log
limit = 2 * int(10 ** 7 / (7 * log(10)))
final = set((i ** 2 for i in sieve_for_primes_to(limit + 1)))
for p in a:
	if p in final:
		print('YES')
	else:
		print('NO')


primes = [True for i in range(10 ** 6)]
for i in range(1, 10 ** 6):
	if primes[i]:
		for j in range(2 * i + 1, 10 ** 6, i + 1):
			primes[j] = False
n = int(input())
a = list(map(int, input().split()))
for i in a:
	if i == 1:
		print('NO')
		continue
	if i ** 0.5 == int(i ** 0.5) and primes[int(i ** 0.5) - 1]:
		print('YES')
	else:
		print('NO')


limit = 1000000

def seive():
	p = [True] * limit
	p[0] = p[1] = False
	for i in range(2, limit):
		if p[i] == True:
			for j in range(i * i, limit, i):
				p[j] = False
	return p

def isPrime(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if p[int(sqrt_n)] == True:
			return True
	return False
p = seive()
n = int(input())
a = list(map(int, input().split()))
for i in a:
	if isPrime(i):
		print('YES')
	else:
		print('NO')


from bisect import bisect_left

def search(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def genPrimes(n):
	sieve = [True] * (n + 1)
	p = 2
	while p * p <= n:
		if sieve[p]:
			for i in range(p * p, n + 1, p):
				sieve[i] = False
		p += 1
	primes = []
	for i in range(2, n + 1):
		if sieve[i]:
			primes.append(i ** 2)
	return primes
poss = genPrimes(1000010)
n = int(input().strip())
arr = list(map(int, input().strip().split()))
for i in arr:
	if search(poss, i) != -1:
		print('YES')
	else:
		print('NO')


import math
prime = [True for i in range(1000000 + 1)]

def SieveOfEratosthenes():
	global prime
	p = 2
	while p * p <= 1000001:
		if prime[p] == True:
			for i in range(p * 2, 1000001, p):
				prime[i] = False
		p += 1
SieveOfEratosthenes()
a = int(input())
b = []
m = map(int, input().split(' '))
for each in m:
	temp = math.sqrt(each)
	if temp == math.floor(temp) and prime[math.floor(temp)] == True and (each != 1):
		print('YES')
	else:
		print('NO')


def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def main():
	n = int(input())
	array = list(map(int, input().split()))
	primes = SieveOfEratosthenes(10 ** 6 + 5)
	primes[1] = False
	for i in array:
		if int(i ** 0.5) == i ** 0.5:
			if primes[int(i ** 0.5)]:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
main()


import math
primes = [True] * 1000001
primes[1] = False
for i in range(2, 1000001):
	if primes[i]:
		for k in range(i * i, 1000001, i):
			primes[k] = False
input()
ln = input().split(' ')
for el in ln:
	q = int(el)
	if math.sqrt(q) == int(math.sqrt(q)) and primes[int(math.sqrt(q))]:
		print('YES')
	else:
		print('NO')


from math import sqrt
l = [True for _ in range(1000000 + 1)]
p = 2
while p ** 2 < 10 ** 6:
	if l[p]:
		for i in range(p ** 2, 10 ** 6 + 1, p):
			l[i] = False
	p += 1
set_ = set()
for i in range(2, 10 ** 6 + 1):
	if l[i]:
		set_.add(i)
n = int(input())
li = list(map(int, input().split()))
for i in range(n):
	if sqrt(li[i]) in set_:
		print('YES')
	else:
		print('NO')


from math import sqrt
n = int(input())
l = list(map(int, input().split()))

def tprime(n):
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
for i in l:
	k = sqrt(i)
	if int(k) == k:
		z = tprime(int(k))
		if z == True and k != 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt

def cal(x):
	if x == 1:
		print('NO')
		return
	y = int(sqrt(x))
	if y * y != x:
		print('NO')
		return
	z = int(sqrt(y))
	for i in range(2, z + 1):
		if y % i == 0:
			print('NO')
			return
	print('YES')
n = int(input().strip())
a = [int(x) for x in input().split()]
for x in a:
	cal(x)


limit = 1000000

def pf():
	prime_flag = [True] * limit
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, limit):
		if prime_flag[i] == True:
			for j in range(i * i, limit, i):
				prime_flag[j] = False
	return prime_flag
n = int(input())
m = list(map(int, input().split()))
pf = pf()
for i in range(n):
	if m[i] == 4:
		print('YES')
		continue
	if m[i] < 4 or m[i] % 2 == 0:
		print('NO')
		continue
	p = m[i] ** 0.5
	if p == int(p):
		if pf[int(p)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


su = [True for i in range(10 ** 6)]
k = set()
for i in range(2, 10 ** 6):
	if su[i]:
		for j in range(i * i, 10 ** 6, i):
			su[j] = False
		k.add(i * i)
n = int(input())
s = [int(p) for p in input().split()]
l = []
for i in range(n):
	if s[i] in k:
		l.append('YES')
	else:
		l.append('NO')
for i in range(n):
	print(l[i], end='\n')


from math import sqrt
n = int(input())
x = list(map(int, input().strip().split(' ')))
sieve = [0, 0] + [1] * 999999
for i in range(2, 1001):
	if sieve[i] == 1:
		for j in range(i * i, 1000001, i):
			sieve[j] = 0
for k in x:
	if k == 4:
		print('YES')
	elif k % 2 == 0:
		print('NO')
	elif k == 1:
		print('NO')
	else:
		r = int(sqrt(k))
		if sieve[r] == 1 and r * r == k:
			print('YES')
		else:
			print('NO')


import math
n = 1000000
prime = [False, False] + [True for i in range(n - 1)]
p = 2
while p * p <= n:
	if prime[p] == True:
		for i in range(p * p, n + 1, p):
			prime[i] = False
	p += 1
int(input())
for i in map(int, input().split()):
	k = int(math.sqrt(i))
	if k * k == i and prime[k]:
		print('YES')
	else:
		print('NO')


n = int(input())
p = list(map(int, input().split()))
n = max(p)
l = [True] * 1000001
(l[0], l[1]) = (False, False)
if n >= 2:
	l[2] = True
	for i in range(2, 1000001):
		if l[i]:
			for j in range(i * i, 1000001, i):
				l[j] = False
for i in p:
	if pow(i, 0.5) == int(pow(i, 0.5)) and l[int(pow(i, 0.5))]:
		print('YES')
	else:
		print('NO')


import sys
from math import sqrt
input = sys.stdin.readline
print = sys.stdout.write

def prime():
	n = 10 ** 6
	p = [True] * (n + 1)
	p[1] = False
	i = 2
	while i * 2 <= n:
		if p[i]:
			for k in range(i * 2, n + 1, i):
				p[k] = False
		i += 1
	return p
n = int(input())
a = list(map(int, input().split()))

def cal(num, p):
	yy = sqrt(num)
	if int(yy) == yy:
		if p[int(yy)]:
			return 0
		else:
			return 1
	else:
		return 1
p = prime()
for i in range(n):
	print('YNEOS'[cal(a[i], p)::2] + '\n')


import math

def prime(x):
	list = [1] * (x + 1)
	(list[0], list[1]) = (0, 0)
	for i in range(2, int(math.sqrt(x)) + 1):
		if list[i] == 1:
			for j in range(i ** 2, x + 1, i):
				list[j] = 0
	return list
a = int(input())
list = input().split()
primelist = prime(1000000)
for i in range(a):
	num = int(list[i])
	x = math.sqrt(num)
	print(['NO', 'YES'][x % 1 == 0 and primelist[int(x)]])


def isprime(n):
	if n == 2:
		return True
	elif n % 2 == 0:
		return False
	else:
		k = int(n ** 0.5)
		for i in range(3, k + 1):
			if n % i == 0:
				return False
		return True
n = int(input())
L = list(map(int, input().split()))
for i in range(n):
	if L[i] == 1:
		print('NO')
	else:
		k = L[i] ** 0.5
		if k - int(k) < 1e-05 and isprime(int(k)):
			print('YES')
		else:
			print('NO')


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
l = inlt()
top = 1000001
p = [True] * top
for i in range(2, top):
	if p[i]:
		for k in range(i + i, top, i):
			p[k] = False
p[1] = False
for i in range(0, len(l)):
	rt = int(math.sqrt(l[i]))
	if p[rt] and rt * rt == l[i]:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
s = list(map(int, input().split()))
a = 10 ** 6

def sieve(n):
	isprime = [True] * (n + 1)
	isprime[1] = False
	for i in range(2, int(n ** 0.5) + 1):
		if isprime[i] == True:
			for j in range(2 * i, n + 1, i):
				isprime[j] = False
	return isprime
primes = sieve(a)
for i in s:
	if i == 1:
		print('NO')
		continue
	t = math.sqrt(i)
	if int(t) != t:
		print('NO')
	elif primes[int(t)]:
		print('YES')
	else:
		print('NO')


n = int(input())
A = [int(i) for i in input().split()]

def checkPrime(n):
	if n < 2:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True
flag = False
for i in A:
	if int(i ** 0.5) == i ** 0.5:
		flag = checkPrime(int(i ** 0.5))
	if flag == True:
		print('YES')
		flag = False
	else:
		print('NO')


import math
n = input()
integers = list(map(int, input().split()))
maximum = int(math.sqrt(max(integers)))
aux = [True for i in range(maximum + 1)]
start = 2
while start * start <= maximum:
	if aux[start]:
		for i in range(start * start, maximum + 1, start):
			aux[i] = False
	start += 1
for integer in integers:
	sqrt = int(math.sqrt(integer))
	isTPrime = sqrt * sqrt == integer and aux[sqrt] and (integer > 3)
	result = 'YES' if isTPrime else 'NO'
	print(result)


import math
n = int(input())
numberlist = [int(x) for x in input().split()]
for i in range(n):
	count = 0
	num = numberlist[i]
	maxdivisor = int(math.sqrt(num))
	if maxdivisor ** 2 == num:
		maxmax = int(math.sqrt(maxdivisor))
		for j in range(maxmax):
			if maxdivisor % (j + 2) == 0:
				count = 1
				break
	else:
		count = 1
	if num == 1:
		print('NO')
	elif count == 0 or num == 4 or num == 9:
		print('YES')
	else:
		print('NO')


import math

def checker(n):
	z = 0
	for i in range(2, int(math.ceil(math.sqrt(n))) + 1):
		if n % i == 0:
			z = 1
			break
		else:
			continue
	return z
t = int(input())
a = list(map(int, input().split()))
for i in range(0, t):
	if a[i] <= 10:
		if a[i] == 4 or a[i] == 9:
			print('YES')
		else:
			print('NO')
	else:
		c = int(math.sqrt(a[i]))
		if c == math.sqrt(a[i]):
			z = checker(c)
			if z == 0:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


n = int(1000000)
prime = [1] * n
s = set()
for i in range(2, n):
	if prime[i]:
		prime[i * i:n:i] = [0] * len(prime[i * i:n:i])
		s.add(i * i)
input()
[print('YES') if d in s else print('NO') for d in map(int, input().split())]


import atexit
import io
import sys
from bisect import *
from collections import *
from fractions import gcd
from itertools import *
from math import *
import os
inf = float('inf')
inf_neg = float('-inf')
range_6 = int(10000000.0 + 1)
range_7 = int(1000000.0 + 1)
range_8 = int(100000000.0 + 1)
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def eratosthenes(n):
	multiples = set()
	for i in range(2, n + 1):
		if i not in multiples:
			yield i
			multiples.update(range(i * i, n + 1, i))

def main():
	primes = eratosthenes(range_7)
	primes_sq = set()
	for i in primes:
		primes_sq.add(i * i)
	n = int(input())
	arr = list(map(int, input().split()))
	for j in arr:
		if j in primes_sq:
			print('{}'.format('YES'))
		else:
			print('{}'.format('NO'))
main()


n = int(input())
nums = list(map(int, input().split()))
aux = [0] * 2 + [1] * 1000001
for i in range(2, 10 ** 3 + 1):
	if aux[i]:
		for j in range(i * 2, 10 ** 6 + 1, i):
			aux[j] = 0
for i in nums:
	if int(i ** 0.5) * int(i ** 0.5) == i and aux[int(i ** 0.5)]:
		print('YES')
	else:
		print('NO')


import math
T_prime = set()
n = int(input())
a = [True] * 1000002
for i in range(2, 1000002):
	if a[i] == True:
		T_prime.add(i * i)
		for j in range(i ** 2, 1000002, i):
			a[j] = False
for i in [int(x) for x in input().split()]:
	print('YES') if i in T_prime else print('NO')


import math
t = int(input())
line = list(map(int, input().split()))
nprimes = [0] * 1000001
nprimes[0] = 1
nprimes[1] = 1
i = 2
while i <= 1000000:
	if nprimes[i] == 0:
		for j in range(2 * i, 1000001, i):
			nprimes[j] = 1
	i = i + 1
for k in line:
	sq = math.sqrt(k)
	ch = int(sq)
	if sq != ch:
		print('NO')
	elif nprimes[ch] == 1:
		print('NO')
	else:
		print('YES')


import math
n = int(input())
data = list(map(int, input().split()))
basicprime = [3, 5, 517, 7, 521, 11, 523, 13, 527, 17, 529, 19, 533, 23, 29, 541, 31, 547, 37, 551, 41, 43, 557, 47, 559, 563, 53, 569, 59, 571, 61, 577, 67, 71, 583, 73, 587, 589, 79, 593, 83, 599, 89, 601, 607, 97, 611, 101, 613, 103, 617, 107, 619, 109, 113, 629, 631, 121, 127, 641, 131, 643, 647, 137, 649, 139, 653, 143, 659, 149, 661, 151, 667, 157, 671, 673, 163, 677, 167, 169, 683, 173, 689, 179, 691, 181, 697, 187, 701, 191, 703, 193, 197, 709, 199, 713, 719, 209, 211, 727, 731, 221, 733, 223, 737, 227, 739, 229, 743, 233, 239, 751, 241, 757, 247, 761, 251, 253, 767, 257, 769, 773, 263, 779, 269, 781, 271, 787, 277, 281, 793, 283, 797, 799, 289, 803, 293, 809, 299, 811, 817, 307, 821, 311, 823, 313, 827, 317, 829, 319, 323, 839, 841, 331, 337, 851, 341, 853, 857, 347, 859, 349, 863, 353, 869, 359, 871, 361, 877, 367, 881, 883, 373, 887, 377, 379, 893, 383, 899, 389, 901, 391, 907, 397, 911, 401, 913, 403, 407, 919, 409, 923, 929, 419, 421, 937, 941, 431, 943, 433, 947, 437, 949, 439, 953, 443, 449, 961, 451, 967, 457, 971, 461, 463, 977, 467, 979, 983, 473, 989, 479, 991, 481, 997, 487, 491, 493, 499, 503, 509]
prime = set((i for i in range(3, 1000000, 2)))
prime.add(2)
for i in basicprime:
	for j in range(3, 333334, 2):
		d = i * j
		if d < 1000000:
			if d in prime:
				prime.remove(d)
		else:
			break
for x in data:
	if x == 1 or x == 2 or x == 3:
		print('NO')
	else:
		q = math.sqrt(x)
		if q % 1 == 0.0:
			print(['NO', 'YES'][q in prime])
		else:
			print('NO')


import math
p = [True for i in range(1000003)]

def init():
	p[0] = p[1] = False
	for i in range(2, 1000003):
		if p[i]:
			for j in range(i, 1000003 // i + 1):
				p[i * j] = False

def is_square(x):
	return int(math.sqrt(x)) * int(math.sqrt(x)) == x

def is_prime(x):
	return p[x]

def t_primes(n, a):
	res = []
	for x in a:
		if is_square(x) and is_prime(int(math.sqrt(x))):
			res.append('YES')
		else:
			res.append('NO')
	return res
init()
n = int(input())
a = list(map(int, input().split()))
result = t_primes(n, a)
print(*result, sep='\n')


import math
import itertools
gh = lambda : map(int, input().split())
N = 2 * 10000000.0 + 5
N = int(N)

def main():
	input()
	d = [0] * N
	d[1] = 1
	for i in range(2, int(10000.0)):
		if d[i] == 0:
			for j in range(i + i, int(2000000.0), i):
				d[j] = 1
	for x in gh():
		t = int(math.sqrt(x))
		bl = d[t]
		if t != math.sqrt(x):
			bl = 1
		if bl:
			print('NO')
		else:
			print('YES')
main()


from sys import stdin
import math
stdin.readline()
nums = list(map(int, stdin.readline().rstrip().split(' ')))
limit = math.ceil(math.sqrt(max(nums)))
prime = [True] * (limit + 1)
p = 2
while p * p <= limit:
	if prime[p]:
		for i in range(p * 2, limit + 1, p):
			prime[i] = False
	p += 1
prime[0] = prime[1] = False
primes = set()
for p in range(limit + 1):
	if prime[p]:
		primes.add(p)
for num in nums:
	if math.sqrt(num) in primes:
		print('YES')
	else:
		print('NO')


primes = [1] * 1000001
for i in range(2, 500001):
	if primes[i] == 1:
		for j in range(2 * i, 1000001, i):
			primes[j] = 0
primes[1] = 0
n = input()
A = input().split(' ')
for i in A:
	k = int(i)
	if int(k ** (1 / 2)) != k ** (1 / 2) or primes[int(k ** (1 / 2))] == 0:
		print('NO')
	else:
		print('YES')


n = int(input())
L = [int(x) for x in input().split()]
import math
for i in range(n):
	m = L[i]
	if m == 4:
		print('YES')
	elif m % 2 == 0:
		print('NO')
	elif m == 1:
		print('NO')
	else:
		l = math.sqrt(m)
		if l.is_integer() == False:
			print('NO')
		else:
			num = 0
			l = int(l)
			for j in range(3, math.ceil(math.sqrt(l)) + 1):
				if l % j == 0:
					print('NO')
					num += 1
					break
			if num == 0:
				print('YES')


n = int(input())
l = list(map(int, input().split()))
m = 10 ** 6 + 1
t = 10 ** 3 + 1
isPrime = []
for i in range(0, m):
	isPrime.append(1)
isPrime[0] = 0
isPrime[1] = 0
for i in range(2, t, 1):
	if isPrime[i]:
		for j in range(i * i, m, i):
			isPrime[j] = 0
for i in range(0, n):
	if isPrime[int(l[i] ** (1 / 2))] and l[i] ** (1 / 2) == float(int(l[i] ** (1 / 2))):
		print('YES')
	else:
		print('NO')


import math

def isprime(w):
	for i in range(3, int(math.sqrt(w)) + 2, 2):
		if w % i == 0:
			return False
	return True
a = int(input())
b = list(map(int, input().split()))
for k in b:
	if k == 4:
		print('YES')
		continue
	elif k % 2 == 0:
		print('NO')
		continue
	elif k < 4:
		print('NO')
		continue
	else:
		g = math.sqrt(k)
		if g != int(g):
			print('NO')
		else:
			x = isprime(int(g))
			if x:
				print('YES')
			else:
				print('NO')


import math
n = int(input())
a = input().split()
pr = [0] * (1000000 + 1)
pr[1] = 1
for i in range(2, 1000 + 1):
	if pr[i] != 0:
		continue
	for j in range(i + i, 1000000 + 1, i):
		pr[j] = 1
for e in a:
	m = int(e)
	sq = math.ceil(math.sqrt(m))
	if m == sq * sq and pr[sq] == 0:
		print('YES')
	else:
		print('NO')


is_prime = [True] * (10 ** 6 + 1)
square_primes = []
for i in range(2, 10 ** 6 + 1):
	if is_prime[i]:
		square_primes.append(i * i)
		for j in range(i + i, 10 ** 6 + 1, i):
			is_prime[j] = False
square_primes = set(square_primes)
n = int(input())
num_list = list(map(int, input().split()))
for i in num_list:
	if i in square_primes:
		print('YES')
	else:
		print('NO')


def go():
	m = 10 ** 6
	m_sq = m ** 2
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	sieve = [True] * m
	for i in range(2, m):
		if sieve[i] == True:
			for j in range(i ** 2, m, i):
				sieve[j] = False
	s = set((i for i in range(2, m) if sieve[i]))
	o = ''
	from math import sqrt
	for i in a:
		sq = sqrt(i)
		if int(sq) == sq:
			if sq in s:
				o += 'YES\n'
			else:
				o += 'NO\n'
		else:
			o += 'NO\n'
	return o
print(go())


n = int(input())
arr = list(map(int, input().split()))
primes = [True] * (10 ** 6 + 1)
primes[0] = primes[1] = False
p = 2
while p * p <= 10 ** 6:
	if primes[p]:
		for i in range(p * p, 10 ** 6 + 1, p):
			primes[i] = False
	p += 1
for x in arr:
	p = x ** 0.5
	if p == int(p):
		if primes[int(p)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
from math import sqrt, ceil
from sys import setrecursionlimit
setrecursionlimit(10 ** 5)
readline = sys.stdin.readline

def util():
	a = set()
	n = 10 ** 6
	prime = [True] * (n + 1)
	p = 2
	while p <= n:
		if prime[p]:
			a.add(p * p)
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = prime[1] = False
	return a

def process():
	_ = int(readline())
	arr = map(int, readline().rstrip().split())
	prime = util()
	for i in arr:
		print('YES') if i in prime else print('NO')
process()


import sys
import math
import itertools
from collections import defaultdict
n = int(sys.stdin.readline().rstrip())
nums = map(int, sys.stdin.readline().rstrip().split())
pr = [False for x in range(10 ** 6 + 1)]
for i in range(2, 10 ** 6):
	if pr[i] == False:
		for j in range(2 * i, 10 ** 6 + 1, i):
			pr[j] = True
for n in nums:
	if n == 1:
		print('NO')
		continue
	cand = int(round(math.sqrt(n)))
	if cand ** 2 == n and pr[cand] == False:
		print('YES')
	else:
		print('NO')


tprime = set()

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			tprime.add(p * p)
SieveOfEratosthenes(10 ** 6)
n = int(input())
l = list(map(int, input().split()))
for i in l:
	if i in tprime:
		print('YES')
	else:
		print('NO')


import math

def solve(elem):
	if elem == 4:
		return 'YES'
	if elem % 2 == 0 or elem == 1:
		return 'NO'
	root = math.sqrt(elem)
	if int(root) * int(root) == elem and primes[int(root)]:
		return 'YES'
	return 'NO'
primes = [True] * (1000000 + 1)
for i in range(2, 1000000 + 1):
	if primes[i] == False:
		continue
	for j in range(i * i, 1000000 + 1, i):
		primes[j] = False
n = int(input())
arr = list(map(int, input().split(' ')))
for elem in arr:
	print(solve(elem))


import math

def sive(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
n = int(input())
l = list(map(int, input().split()))
okay = l.copy()
okay.sort()
n2 = int(math.sqrt(okay[-1])) + 1
temp2 = sive(n2)
for i in range(n):
	temp = math.sqrt(l[i])
	if l[i] == 1:
		print('NO')
	elif temp == int(temp):
		temp = int(temp)
		if temp2[temp]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
numberlist = [int(x) for x in input().split()]
for i in range(n):
	count = 0
	num = numberlist[i]
	s1 = int(num ** 0.5)
	if s1 ** 2 == num:
		s2 = int(s1 ** 0.5)
		if s2 == 1 and s1 == 1:
			count = 1
		if s2 == 2 and s1 % 2 == 0:
			count = 1
		if s2 > 2:
			for j in range(s2 - 1):
				if s1 % (j + 2) == 0:
					count = 1
					break
	else:
		count = 1
	if count == 1:
		print('NO')
	if count == 0:
		print('YES')


input()
p = lambda v: all((v % i for i in range(2, int(v ** 0.5) + 1)))
l = 1000002
c = [0] * l
c[0] = c[1] = 1
for i in range(2, l):
	if 1 - c[i]:
		for j in range(i * i, l, i):
			c[j] = 1
for i in input().split():
	i = int(i)
	r = int(i ** 0.5)
	print('YNEOS'[c[r] or r * r != i::2])


from math import *
n = int(input())
numbers = list(map(int, input().split()))

def is_prime(x):
	for divider in range(2, int(sqrt(x)) + 1):
		if x % divider == 0:
			return False
	return True
for num in numbers:
	if num != 1 and int(sqrt(num)) ** 2 == num and is_prime(int(sqrt(num))):
		print('YES')
	else:
		print('NO')


import sys

def sieve(n):
	ary = [True] * (n + 1)
	ary[0] = ary[1] = False
	for i in range(4, n + 1, 2):
		ary[i] = False
	for i in range(3, int(n ** 0.5) + 1, 2):
		for j in range(i * i, n + 1, i):
			ary[j] = False
	return ary

def f(n):
	if n == 1:
		return 'NO'
	m = int(n ** 0.5)
	if primes[m] and m * m == n:
		return 'YES'
	return 'NO'
primes = sieve(10 ** 6 + 1)
n = sys.stdin.readline()
ary = map(int, sys.stdin.readline().split())
for i in ary:
	print(f(i))


import math
t = int(input())
arr = input().split()

def isp(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
for n in arr:
	n = int(n)
	sqrt = int(math.sqrt(n))
	if n == sqrt * sqrt and n != 1 and isp(sqrt):
		print('YES')
	else:
		print('NO')


s = set()
LIM = 1000001

def montaP(s):
	p = [1] * LIM
	for i in range(2, LIM):
		if p[i]:
			s.add(i * i)
			for k in range(2 * i, LIM, i):
				p[k] = 0
montaP(s)
n = int(input())
l = map(int, input().split())
for i in l:
	print('YES') if i in s else print('NO')


n = int(input())
l = [0] * 1000002
l[0] = 1
l[1] = 1
for i in range(2, len(l)):
	if l[i] == 0:
		for j in range(i * i, 1000002, i):
			l[j] = 1
for e in [int(b) for b in input().split()]:
	a = int(e ** (1 / 2))
	if l[a] == 0 and a * a == e:
		print('YES')
	else:
		print('NO')


import math

def inp():
	return int(input())

def inps():
	return map(int, input().split())

def is_sq(n):
	return pow(math.sqrt(n), 2) == n

def sieve(n):
	np1 = n + 1
	s = list(range(np1))
	s[1] = 0
	sqrtn = int(round(n ** 0.5))
	for i in range(2, sqrtn + 1):
		if s[i]:
			s[i * i:np1:i] = [0] * len(range(i * i, np1, i))
	return set(filter(None, s))
n = inp()
primes = primes = sieve(1000006)
for i in inps():
	if is_sq(i):
		if math.sqrt(i) in primes:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def buildPrime(arr):
	arr[0] = arr[1] = False
	for i in range(2, 1000000):
		if arr[i] == True:
			for j in range(i * i, 1000000, i):
				arr[j] = False
	return arr
prime_mat = [True] * 1000000
prime_mat = buildPrime(prime_mat)

def check(a):
	if a == 4:
		return 'YES'
	if a < 4 or a % 2 == 0:
		return 'NO'
	sqrt = a ** 0.5
	if sqrt == int(sqrt):
		if prime_mat[int(sqrt)] == True:
			return 'YES'
	return 'NO'
t = int(input())
arr = list(map(int, input().split()))
for i in range(t):
	print(check(arr[i]))


import math
N = 1000001
c = [True] * N
c[1] = False
i = 2
while i * i < N:
	if c[i] == True:
		j = i * i
		while j < N:
			c[j] = False
			j += i
	i += 1
n = int(input())
a = list(map(int, input().split()))
i = -1
while i < n - 1:
	i += 1
	b = int(math.sqrt(a[i]))
	if c[b] and b ** 2 == a[i] and (a[i] > 2):
		print('YES')
	else:
		print('NO')


import math

def genPrime(n):
	prime = [True] * (n + 1)
	(prime[0], prime[1]) = (False, False)
	i = 2
	while i * i <= n:
		if prime[i]:
			for j in range(i * 2, n + 1, i):
				prime[j] = False
		i += 1
	return prime
n = int(input())
x = list(map(int, input().split()))
p = genPrime(int(math.sqrt(max(x))))
for i in x:
	if int(math.sqrt(i) + 0.5) ** 2 == i:
		print('YES' if p[int(math.sqrt(i))] else 'NO')
	else:
		print('NO')


import sys
from math import sqrt
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			print(p)

def myVersionOfSieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	prime[0] = prime[1] = False
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def checkPerfectSquare(n):
	root = sqrt(n)
	if int(root + 0.5) ** 2 == n:
		return True
	else:
		return False
t = int(input())
nums = list(map(int, input().split()))
n = 10 ** 12
primeCheck = myVersionOfSieveOfEratosthenes(int(sqrt(n)))
for num in nums:
	if checkPerfectSquare(num):
		root = int(sqrt(num))
		if primeCheck[root] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def f1(n=10 ** 6):
	a = [False, True] * (n // 2 + 1)
	y = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
	b = [166666, 99998, 71426, 45450, 38456, 29404, 26307, 21728, 17227, 16114, 13496, 12175, 11607, 10615, 9408, 8446, 8167, 7430, 7007, 6813, 6290, 5983, 5574, 5107, 4901, 4803, 4620, 4533, 4369, 3874, 3752, 3582, 3528, 3282, 3236, 3107, 2986, 2911, 2804, 2704, 2672, 2523, 2495, 2440, 2414, 2265, 2131, 2090, 2069, 2030, 1973, 1955, 1867, 1818, 1770, 1725, 1710, 1667, 1639, 1626, 1560, 1476, 1453, 1441, 1419, 1346, 1316, 1268, 1259, 1240, 1214, 1179, 1154, 1130, 1114, 1091, 1061, 1047, 1018, 984, 978, 945, 939, 920, 908, 890, 866, 855, 849, 838, 805, 784, 773, 753, 743, 728, 700, 695, 654, 641, 620, 607, 595, 591, 579, 559, 547, 536, 532, 521, 510, 502, 499, 477, 460, 457, 450, 440, 430, 426, 407, 401, 391, 379, 363, 351, 336, 325, 316, 308, 302, 291, 283, 277, 266, 261, 242, 229, 214, 212, 199, 197, 192, 189, 177, 160, 155, 153, 148, 132, 128, 125, 121, 98, 94, 85, 74, 66, 61, 55, 49, 34, 30, 24, 18, 10, 4]
	for (y, b) in zip(y, b):
		a[y * y::y + y] = [False] * b
	return [4] + [i ** 2 for i in range(3, 10 ** 6, 2) if a[i]]

def main():
	n = int(input())
	x = list(map(int, input().split()))
	z = set(f1())
	print('\n'.join(['YES' if x in z else 'NO' for x in x]))
main()


import sys
from bisect import bisect_left, bisect_right
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil
from itertools import permutations
inf = float('inf')
mod = 1000000007
mini = 1000000007

def fact(n):
	if n == 0:
		return 1
	p = 1
	d = 10 ** 9 + 7
	for i in range(1, n + 1):
		p = p * i
		p = p % d
	return p

def ncr(n, r):
	d = 10 ** 9 + 7
	num = fact(n)
	den = fact(r) * fact(n - r) % d
	den = pow(den, d - 2, d)
	return num * den % d

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	myset = set()
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p = p + 1
	return prime

def binary(number):
	result = 0
	while number:
		result = result + 1
		number = number & number - 1
	return result

def calculate_factors(n):
	hh = [1] * (n + 1)
	p = 2
	while p * p < n:
		if hh[p] == 1:
			for i in range(p * 2, n, p):
				hh[i] = 0
		p += 1
	total = 1
	for p in range(2, n + 1):
		if hh[p] == 1:
			count = 0
			if n % p == 0:
				while n % p == 0:
					n = int(n / p)
					count += 1
				total *= count + 1
	return total

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
prime = sieve(1000003)
n = int(input())
Arr = get_array()
for i in Arr:
	if i == 1:
		print('NO')
	elif sqrt(i) == ceil(sqrt(i)):
		if prime[int(ceil(sqrt(i)))] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


sieve = [True] * 1000001
(sieve[0], sieve[1]) = (False, False)
for i in range(2, 1000001):
	if sieve[i]:
		for j in range(i * i, 1000001, i):
			sieve[j] = False
t = int(input())
l = list(map(int, input().split()))
for i in l:
	a = int(i ** 0.5)
	if a * a == i and sieve[a]:
		print('YES')
	else:
		print('NO')


import math
import itertools
N = 10 ** 6
isprime = [True] * (N + 1)
isprime[0] = isprime[1] = False
sq = math.ceil(N ** 0.5)
for i in range(2, sq + 1):
	if isprime[i]:
		for j in range(i ** 2, N + 1, i):
			isprime[j] = False
primes = itertools.compress(range(N + 1), isprime)
squares = set(map(lambda x: x ** 2, primes))
n = int(input())
A = [int(x) for x in input().split()]
B = map(lambda a: 'YES' if a in squares else 'NO', A)
print('\n'.join(B))


oo = 10 ** 6
p = [True] * (oo + 1)

def primes():
	global p
	p[0] = p[1] = False
	for i in range(int(oo ** 0.5) + 1):
		if p[i]:
			j = i * i
			while True:
				if j > oo:
					break
				p[j] = False
				j += i
primes()

def isSquare(k):
	ck = int(k ** 0.5)
	if ck * ck == k:
		return True
	return False
n = input()
sn = input()
for v in sn.split():
	u = int(v)
	if isSquare(u) and p[int(u ** 0.5)]:
		print('YES')
	else:
		print('NO')


from math import sqrt
n = int(input())
l = list(map(int, input().split()))
s = [1 for i in range(1000005)]
x = set()
for i in range(2, int(sqrt(1000005)) + 1):
	if s[i] == 1:
		for j in range(i * i, 1000005, i):
			s[j] = 0
for i in range(2, 1000005):
	if s[i] == 1:
		x.add(i * i)
for i in range(n):
	if l[i] == 1:
		print('NO')
	elif l[i] in x:
		print('YES')
	else:
		print('NO')


_ = input()
x = map(int, input().split())
limit = 1000001
table = [1] * 2 + [0] * limit
for i in range(2, limit):
	if not table[i]:
		for j in range(i ** 2, limit, i):
			table[j] = 1
for num in x:
	sqrt = int(num ** 0.5)
	print('NO' if table[sqrt] or sqrt ** 2 != num else 'YES')


import math
n = int(input())
a = [int(x) for x in input().split()]
c = [0] * 2000000
c[1] = 1
ma = int(1000000)
for i in range(2, ma + 1):
	if c[i] == 0:
		d = i
		for j in range(d * d, ma + 1, i):
			c[j] = 1
for i in range(n):
	tmp = a[i]
	b = a[i] ** 0.5
	if b == int(b):
		if c[int(b)] == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def oula(n):
	prime = [0 for i in range(n + 1)]
	common = []
	for i in range(2, n + 1):
		if prime[i] == 0:
			common.append(i)
		for j in common:
			if i * j > n:
				break
			prime[i * j] = 1
			if i % j == 0:
				break
	return common
s = set(oula(1000000))
import math

def is_sqr(n):
	a = int(math.sqrt(n))
	return a * a == n
n = int(input())
number = list(map(int, input().split()))
for j in range(n):
	if number[j] == 1 or not is_sqr(number[j]):
		print('NO')
	elif math.sqrt(number[j]) in s:
		print('YES')
	else:
		print('NO')


prime = [True] * (10 ** 6 + 1)
prime[0] = False
prime[1] = False
p = 2
while p <= 1000:
	if prime[p] == True:
		for i in range(2 * p, 1000001, p):
			prime[i] = False
	p += 1
n = int(input())
data = list(map(int, input().split()))
for t in range(n):
	i = data[t]
	if i < 4:
		print('NO')
	elif int(i ** 0.5) ** 2 != i:
		print('NO')
	elif prime[int(i ** 0.5)]:
		print('YES')
	else:
		print('NO')


from math import sqrt, pow

def is_prime(number):
	if number == 1:
		return False
	if number != 2 and number % 2 == 0:
		return False
	i = 3
	while i * i <= number:
		if number % i == 0:
			return False
		i += 2
	return True
n = int(input())
s = list(map(int, input().split()))
for x in s:
	if pow(int(sqrt(x)), 2) != x:
		print('NO')
		continue
	if is_prime(int(sqrt(x))):
		print('YES')
	else:
		print('NO')


import math

def sieve(n):
	sq = set()
	prime = [1 for i in range(n)]
	prime[0] = prime[1] = 0
	for i in range(2, n):
		if prime[i]:
			sq.add(i * i)
			for j in range(2 * i, n, i):
				prime[j] = 0
	return sq
ans = sieve(1000001)
n = int(input())
l = [int(x) for x in input().split()]
for i in l:
	if i in ans:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
a = list(map(int, input().split()))
s = [False] * 2 + [True] * 999999
for i in range(2, 1001):
	if s[i]:
		for j in range(i * 2, 1000001, i):
			s[j] = 0
for i in a:
	sq = math.sqrt(i)
	if sq - int(sq) == 0 and s[int(sq)]:
		print('YES')
	else:
		print('NO')


import math

def prime(x):
	if x == 2:
		return 'YES'
	elif x == 1:
		return 'NO'
	else:
		i = 2
		while i <= int(math.sqrt(x)):
			if x % i == 0:
				return 'NO'
				break
			i += 1
		if i == int(math.sqrt(x)) + 1:
			return 'YES'

def sqrt(x):
	a = int(math.sqrt(x))
	return a * a == x
n = int(input())
l = [int(x) for x in input().split()]
for i in l:
	print(prime(int(math.sqrt(i))) if sqrt(i) else 'NO')


line = int(input())
n = [int(x) for x in input().split()]

def primelist(x):
	l_all = [True for i in range(x + 1)]
	l_all[0] = False
	l_all[1] = False
	l2 = list(range(2, int(x ** 0.5) + 2))
	for i in l2:
		if l_all[i] == True:
			for j in range(i * i, x + 1, i):
				l_all[j] = False
	return l_all
l = primelist(10 ** 6 + 1)
for i in n:
	if i ** 0.5 == int(i ** 0.5) and l[int(i ** 0.5)]:
		print('YES')
	else:
		print('NO')


def sqr(x):
	root = int(x ** 0.5) - 1
	if root * root == x:
		return root
	root += 1
	if root * root == x:
		return root
	root += 1
	if root * root == x:
		return root
	return -1
prime = [1] * 1000001
prime[0] = prime[1] = 0
for i in range(2, 1001):
	if prime[i] == 1:
		for j in range(i * i, 1000001, i):
			prime[j] = 0
n = int(input())
numbers = map(int, input().split())
for i in numbers:
	root = int(sqr(i))
	if root != -1 and prime[root]:
		print('YES')
	else:
		print('NO')


from math import sqrt

def primo(num):
	if num <= 1:
		return False
	if num <= 3:
		return True
	if num % 2 == 0 or num % 3 == 0:
		return False
	k = int(sqrt(num)) + 1
	for i in range(5, k, 6):
		if num % i == 0 or num % (i + 2) == 0:
			return False
	return True

def three_dividors(number):
	raiz = int(sqrt(number))
	if raiz * raiz != number:
		return False
	if primo(raiz):
		return True
	else:
		return False
times = int(input())
entrada = input().split(' ')
for i in range(len(entrada)):
	if three_dividors(int(entrada[i])):
		print('YES')
	else:
		print('NO')


import math
n = int(input())
array = list(map(int, input().split()))
sieve = [False] * 2 + [True] * 1000001
for i in range(2, 1001):
	if sieve[i]:
		for j in range(i * 2, 1000001, i):
			sieve[j] = False
for i in array:
	sqrt = math.sqrt(i)
	if sqrt - int(sqrt) == 0 and sieve[int(sqrt)]:
		print('YES')
	else:
		print('NO')


n = int(input())
nums = list(map(int, input().split()))
primes = [True for i in range(10 ** 6 + 1)]
primes[0] = False
primes[1] = False
p = 2
while p ** 2 <= 10 ** 6:
	if primes[p] == True:
		for i in range(p * 2, 10 ** 6 + 1, p):
			primes[i] = False
	p += 1
for num in nums:
	sqrts = num ** (1 / 2)
	if sqrts == int(sqrts) and primes[int(sqrts)]:
		print('YES')
	else:
		print('NO')


lim = int(10 ** 6)
sq = set()

def rwh_primes2(n):
	correction = n % 6 > 1
	n = {0: n, 1: n - 1, 2: n + 4, 3: n + 3, 4: n + 2, 5: n + 1}[n % 6]
	sieve = [True] * (n // 3)
	sieve[0] = False
	for i in range(int(n ** 0.5) // 3 + 1):
		if sieve[i]:
			k = 3 * i + 1 | 1
			sieve[k * k // 3::2 * k] = [False] * ((n // 6 - k * k // 6 - 1) // k + 1)
			sieve[(k * k + 4 * k - 2 * k * (i & 1)) // 3::2 * k] = [False] * ((n // 6 - (k * k + 4 * k - 2 * k * (i & 1)) // 6 - 1) // k + 1)
	return [2, 3] + [3 * i + 1 | 1 for i in range(1, n // 3 - correction) if sieve[i]]
p = rwh_primes2(lim)
sq = set([x * x for x in p])
n = int(input())
l = list(map(int, input().split(' ')))
for i in l:
	if i in sq:
		print('YES')
	else:
		print('NO')


t = int(input())
l = [int(i) for i in input().split()]
primes = [1 for i in range(1000000 + 1)]
p = 2
while p * p <= 1000000:
	if primes[p] == 1:
		for j in range(p * 2, 1000000 + 1, p):
			primes[j] = 0
	p += 1
for e in l:
	if e == 1:
		print('NO')
	elif e ** 0.5 == int(e ** 0.5) and primes[int(e ** 0.5)] == 1:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
x = list(map(int, input().split()))
limit = int(math.sqrt(max(x))) + 2
l2 = [0 for i in range(0, limit)]
p = 2
while p < limit:
	y = p * p
	while y < limit:
		l2[y] = 1
		y = y + p
	for i in range(p + 1, limit):
		if l2[i] == 0:
			p = i
			break
	else:
		p = limit
l3 = [0 for i in range(0, n)]
for i in range(0, n):
	b = math.sqrt(x[i])
	if x[i] == 1:
		l3[i] = 'NO'
	elif b - int(b) == 0 and l2[int(b)] == 0:
		l3[i] = 'YES'
	else:
		l3[i] = 'NO'
print('\n'.join(l3))


def t_prime(lst):
	(primes, st) = ([0] * int(1000000.0), set())
	for i in range(2, int(1000000.0)):
		if not primes[i]:
			st.add(i * i)
			primes[i * i::i] = [1] * len(primes[i * i::i])
	a = list()
	for elem in lst:
		if elem in st:
			a.append('YES')
		else:
			a.append('NO')
	return a
n = int(input())
b = [int(j) for j in input().split()]
print(*t_prime(b), sep='\n')


input()
ds = [1, 1] + [0] * 1000003
for i in range(2, 1000001):
	if ds[i] == 0:
		for j in range(i * i, 1000001, i):
			ds[j] = 1
for i in input().split():
	i = int(i)
	r = int(i ** 0.5)
	print('YNEOS'[ds[r] or r * r != i::2])


n = 2 ** 20
a = [1] * n
tprimes = {4}
for i in range(2, n):
	if a[i] == 1:
		for j in range(i * i, n, i):
			a[j] = 0
		tprimes.add(i * i)
t = int(input())
for ip in map(int, input().split()):
	if ip in tprimes:
		print('YES')
	else:
		print('NO')


def si(x):
	prime = [True] * (x + 1)
	prime[1] = False
	for i in range(2, x + 1):
		if prime[i]:
			for m in range(i * i, x + 1, i):
				prime[m] = False
	return prime
n = int(input())
m = si(1000009)
c = [int(x) for x in input().split()]
for a in c:
	if a ** 0.5 % 1 != 0:
		print('NO')
		continue
	if a ** 0.5 % 1 == 0:
		y = int(a ** 0.5)
		if m[y]:
			print('YES')
			continue
		else:
			print('NO')
			continue


def primes():
	n = input()
	array = tuple(map(int, input().split()))
	for element in array:
		i = element ** 0.5
		if i == 1:
			print('NO')
		elif i - int(i) != 0:
			print('NO')
		elif check_prime(int(i)):
			print('YES')
		else:
			print('NO')

def check_prime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True
primes()


def calculate_prime_flag_for_each_number_upto_limit(limit):
	prime_flag = [True] * limit
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, limit):
		if prime_flag[i] == True:
			for j in range(i * i, limit, i):
				prime_flag[j] = False
	return prime_flag

def check_if_a_number_is_t_prime(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if prime_flag[int(sqrt_n)] == True:
			return True
	return False
total_numbers = int(input())
input_array = list(map(int, input().split()))
from math import sqrt
limit = int(sqrt(max(input_array)) + 1)
prime_flag = calculate_prime_flag_for_each_number_upto_limit(limit)
for i in input_array:
	if check_if_a_number_is_t_prime(i) == True:
		print('YES')
	else:
		print('NO')


def isprime(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return 'NO'
	return 'YES'
import math
n = int(input())
l = [int(i) for i in input().split()]
for i in l:
	if i == 1:
		print('NO')
	elif math.sqrt(i) == int(math.sqrt(i)):
		print(isprime(int(math.sqrt(i))))
	else:
		print('NO')


def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	tprime = {4: True}
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for i in range(3, n + 1):
		if prime[i]:
			tprime[int(i ** 2)] = True
	return tprime
n = int(input())
tprime = SieveOfEratosthenes(1000000)
a = list(map(int, input().split()))
for i in a:
	if i in tprime:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write()
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def is_prime(n):
	if n == 1:
		return False
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
n = int(input())
prime = SieveOfEratosthenes(10 ** 6)
l = list(map(int, input().split()))
for i in range(n):
	x = math.sqrt(l[i])
	if x % 1 == 0 and x != 1:
		if prime[int(x)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
input()
a = list(map(int, input().split()))
primes = []
n = 1000000
is_prime = [False, False] + [True] * (n - 1)
for p in range(2, n + 1):
	if is_prime[p]:
		primes.append(p)
		for x in range(p * 2, n + 1, p):
			is_prime[x] = False
t_primes = set([x * x for x in primes])
for x in a:
	if x in t_primes:
		print('YES')
	else:
		print('NO')


n = int(input())
l = [int(x) for x in input().split()]

def primes(n):
	f = []
	for i in range(n + 1):
		if i > 2 and i % 2 == 0:
			f.append(0)
		else:
			f.append(1)
	i = 3
	while i * i <= n:
		if f[i] == 1:
			j = i * i
			while j <= n:
				f[j] = 0
				j += i + i
		i += 2
	return f
p = primes(10 ** 6)
for i in range(n):
	if l[i] == 1:
		print('NO')
	else:
		k = l[i] ** 0.5
		if k % 1 == 0:
			if p[int(k)] == 1:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


n = 1000000
l = [1] * n
s = set()
for i in range(2, n):
	if l[i]:
		s.add(i * i)
		for j in range(i * i, n, i):
			l[j] = 0
input()
for x in list(map(int, input().split())):
	print('YNEOS'[x not in s::2])


def prime_sieve_eratosthenes(num):
	primes = [True for i in range(num + 1)]
	p = 2
	while p * p <= num:
		if primes[p] == True:
			for i in range(p * p, num + 1, p):
				primes[i] = False
		p += 1
	return primes
primes = prime_sieve_eratosthenes(1000000)
n = int(input())
li = list(map(int, input().split()))
for i in li:
	if i == 1:
		print('NO')
	elif i ** 0.5 == int(i ** 0.5):
		if primes[int(i ** 0.5)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math

def main():
	N = 1000001
	p = [True] * N
	a = set()
	for i in range(2, N):
		if p[i]:
			a.add(i * i)
			for j in range(i, N, i):
				p[j] = False
	n = map(int, input().split())
	m = list(map(int, input().split()))
	for k in m:
		if k in a:
			print('YES')
		else:
			print('NO')
main()


import math
n = int(input())
a = map(int, input().split())

def rwh_primes2(n):
	correction = n % 6 > 1
	n = {0: n, 1: n - 1, 2: n + 4, 3: n + 3, 4: n + 2, 5: n + 1}[n % 6]
	sieve = [True] * (n // 3)
	sieve[0] = False
	for i in range(int(n ** 0.5) // 3 + 1):
		if sieve[i]:
			k = 3 * i + 1 | 1
			sieve[k * k // 3::2 * k] = [False] * ((n // 6 - k * k // 6 - 1) // k + 1)
			sieve[(k * k + 4 * k - 2 * k * (i & 1)) // 3::2 * k] = [False] * ((n // 6 - (k * k + 4 * k - 2 * k * (i & 1)) // 6 - 1) // k + 1)
	e = [0] * 2 + [1] * 2 + [0] * n
	for i in range(1, n // 3 - correction):
		if sieve[i]:
			e[3 * i + 1 | 1] = 1
	return e
e = rwh_primes2(10 ** 6 + 5)
for x in a:
	u = int(math.sqrt(x))
	ok = e[u] and u * u == x
	print('YES' if ok else 'NO')


import sys
import math

def precompute_prime_square():
	n = 10 ** 6
	prime = [True] * (n + 1)
	p = 2
	sett = set()
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for i in range(2, n):
		if prime[i]:
			sett.add(i ** 2)
	return sett

def solution(sett):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	for i in arr:
		if i in sett:
			print('YES')
		else:
			print('NO')
sett = precompute_prime_square()
solution(sett)


def pr(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return n > 1
n = int(input())
a = list(map(int, input().split()))
for i in a:
	if int(i ** 0.5) ** 2 == i and pr(int(i ** 0.5)):
		print('YES')
	else:
		print('NO')


import math as m

def prime(a):
	for i in range(2, int(m.sqrt(a)) + 1):
		if a % i == 0:
			return False
	return True
n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	if l[i] == 0 or l[i] == 1:
		print('NO')
	elif m.sqrt(l[i]) % 1 == 0:
		if prime(int(m.sqrt(l[i]))):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
list = list(map(int, input().split()))

def prime(n):
	if n == 1:
		return False
	elif n ** 0.5 != int(n ** 0.5):
		return False
	else:
		y = int(n ** 0.5)
		for i in range(2, int(y ** 0.5) + 1):
			if y % i == 0:
				return False
		return True
for i in list:
	if prime(i):
		print('YES')
	else:
		print('NO')


import math

def prime():
	num = 1000001
	sqnum = int(math.ceil(math.sqrt(num)) + 1.0)
	mark[1] = 1
	mark[2] = 0
	for i in range(4, num, 2):
		mark[i] = 1
	for i in range(1, num, 2):
		if mark[i] != 1:
			if i <= num:
				for j in range(i * i, num, i * 2):
					mark[j] = 1
mark = 1000001 * [0]
prime()
n = int(input())
d = list(map(int, input().split()))
for i in range(n):
	if math.ceil(math.sqrt(d[i])) != math.floor(math.sqrt(d[i])):
		print('NO')
	else:
		s = int(math.sqrt(d[i]))
		if mark[s] == 0:
			print('YES')
		else:
			print('NO')


from math import sqrt
int(input())
lst = list(map(int, input().split()))

def isPrime(n):
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def isTPrime(n):
	if n > 3:
		rt = sqrt(n)
		if rt == int(rt):
			if isPrime(int(rt)):
				return True
	return False
for n in lst:
	if isTPrime(n):
		print('YES')
	else:
		print('NO')


a = input()
d = []
m = set()
for i in range(2, 1000001):
	if i not in m:
		d.append(i ** 2)
		m.update(range(i * i, 1000001, i))
d = set(d)
for a in [int(b) for b in input().split()]:
	if a in d:
		print('YES')
	else:
		print('NO')


n = int(input())
list1 = [int(x) for x in input().split(' ')]

def prime(x):
	if x == 1:
		return False
	else:
		z = 0
		if x ** 0.5 != int(x ** 0.5):
			return False
		else:
			y = int(x ** 0.5)
			for i in range(2, int(y ** 0.5) + 1):
				if y % i == 0:
					z = 1
					return False
					break
			if z == 0:
				return True
for j in list1:
	if prime(j) == True:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
maxp = 1000000
p = [True] * (maxp + 1)
q = set()
for i in range(2, maxp + 1):
	if p[i]:
		q.add(i * i)
		for j in range(i + i, maxp + 1, i):
			p[j] = False
for ai in a:
	print('YES' if ai in q else 'NO')


import math
hh = [True for i in range(0, 1000001)]

def sieve():
	n = 1000000
	hh[0] = hh[1] = False
	p = 2
	while p * p <= n:
		if hh[p]:
			for i in range(p * p, n + 1, p):
				hh[i] = False
		p += 1
n = int(input())
lt = list(map(int, input().strip().split()))
sieve()
for i in lt:
	x = int(math.sqrt(i))
	if x * x == i:
		if hh[x]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math

def prime(n):
	if n == 1:
		return False
	if n == 2:
		return True
	elif n % 2 == 0:
		return False
	else:
		s = int(math.sqrt(n))
		for i in range(3, s + 1, 2):
			if n % i == 0:
				return False
	return True
p = []
for j in range(1, 1000):
	if prime(j):
		p.append(j)
n = int(input())
li = [int(r) for r in input().split()]
for k in range(n):
	q = int(math.sqrt(li[k]))
	if q == 1:
		print('NO')
	elif q ** 2 != li[k]:
		print('NO')
	else:
		for m in p:
			if q % m == 0 and q not in p:
				print('NO')
				break
		else:
			print('YES')


from math import sqrt

def sqroot(num):
	root = int(sqrt(num)) - 1
	if root ** 2 == num:
		return root
	root += 1
	if root ** 2 == num:
		return root
	root += 1
	if root ** 2 == num:
		return root
	return -1
N = int(1000000.0)
Nroot = int(1000.0)
primes = [1] * (N + 1)
(primes[0], primes[1]) = (0, 0)
for i in range(2, Nroot + 1):
	if primes[i] == 1:
		for j in range(i * i, N + 1, i):
			primes[j] = 0
n = int(input())
x = list(map(int, input().split()))
for i in x:
	r = sqroot(i)
	if r != -1 and primes[r]:
		print('YES')
	else:
		print('NO')


import math
n = 10 ** 6 + 1
prime = [True] * n
prime[0] = False
prime[1] = False
for i in range(2, n):
	if prime[i]:
		for j in range(i * i, n, i):
			prime[j] = False
input()
for d in map(int, input().split()):
	dd = int(math.sqrt(d))
	if prime[dd] and dd * dd == d:
		print('YES')
	else:
		print('NO')


from math import sqrt

def prime(a):
	d = dict()
	for i in range(1, a + 1):
		d[i] = True
	d[1] = False
	for i in range(2, int((a + 1) ** 0.5) + 1):
		if d[i]:
			for j in range(2, a // i + 1):
				if d[i * j]:
					d[i * j] = False
	return d
m = int(input())
k = prime(1000000)
print('\n'.join([['NO', 'YES'][sqrt(i) % 1 == 0 and k[sqrt(i)]] for i in [int(x) for x in input().split()]]))


def primes2(n):
	(n, correction) = (n - n % 6 + 6, 2 - (n % 6 > 1))
	sieve = [True] * (n // 3)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if sieve[i]:
			k = 3 * i + 1 | 1
			sieve[k * k // 3::2 * k] = [False] * ((n // 6 - k * k // 6 - 1) // k + 1)
			sieve[k * (k - 2 * (i & 1) + 4) // 3::2 * k] = [False] * ((n // 6 - k * (k - 2 * (i & 1) + 4) // 6 - 1) // k + 1)
	return [2, 3] + [3 * i + 1 | 1 for i in range(1, n // 3 - correction) if sieve[i]]
n = 1000000
y = [0] * 1000001
t = primes2(n)
for i in t:
	y[i] = 1
q = int(input())
import math
w = list(map(int, input().split()))
for i in w:
	if i == 1:
		print('NO')
	else:
		e = int(math.sqrt(i))
		if e * e == i and y[e] == 1:
			print('YES')
		else:
			print('NO')


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
N = int(input())
l = list(map(int, input().split()))
for i in l:
	c = 0
	d = int(i ** 0.5)
	if d * d == i:
		for j in range(2, int(d ** 0.5 + 1)):
			if d % j == 0:
				print('NO')
				break
		else:
			if i != 1:
				print('YES')
			else:
				print('NO')
	else:
		print('NO')


import sys
from math import sqrt, floor, factorial, gcd
from collections import deque, Counter, defaultdict
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def solve():
	is_prime = [1 for i in range(10 ** 6 + 1)]
	is_prime[1] = 0
	i = 2
	while i * i < 10 ** 6 + 1:
		j = i
		if is_prime[j]:
			while j * i < 10 ** 6 + 1:
				is_prime[j * i] = 0
				j += 1
		i += 1
	ans = ''
	n = int(inp())
	arr = read()
	for i in arr:
		root = int(sqrt(i))
		if root ** 2 == i and is_prime[root]:
			ans += 'YES\n'
		else:
			ans += 'NO\n'
	print(ans)
solve()


from math import sqrt

def is_prime(x):
	if x == 0 or x == 1:
		return 'NO'
	elif x == 2:
		return 'YES'
	for z in range(2, int(sqrt(x)) + 1):
		if x % z == 0:
			return 'NO'
	return 'YES'
length = int(input())
arr = list(map(int, input().split()))
for y in arr:
	i = sqrt(y)
	if i == int(i):
		print(is_prime(int(i)))
	else:
		print('NO')


import math

def find(primes, x):
	primes[0] = primes[1] = False
	for i in range(2, x + 1):
		if primes[i]:
			for j in range(i * i, x + 1, i):
				primes[j] = False

def square(a):
	if math.sqrt(a) == int(math.sqrt(a)):
		return 1
	else:
		return 0
x = 1000000
primes = [True] * (x + 1)
find(primes, x)
n = int(input())
li = list(map(int, input().split()))
for i in li:
	if i == 4:
		print('YES')
	elif i % 2 == 0:
		print('NO')
	elif square(i) and primes[int(math.sqrt(i))]:
		print('YES')
	else:
		print('NO')


from math import *

def prime(n):
	if n < 2:
		return False
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
h = int(input())
f = list(map(int, input().split()))
for j in f:
	x = int(sqrt(j))
	if x * x == j and prime(x):
		print('YES')
	else:
		print('NO')


from math import *
import sys
input = sys.stdin.readline
print = sys.stdout.write
n = int(input())
primes = [True] * (10 ** 6 + 1)
primes[0] = primes[1] = False
for i in range(10 ** 6 + 1):
	if primes[i]:
		for j in range(i * 2, 10 ** 6 + 1, i):
			primes[j] = False
A = [int(i) for i in input().split()]
for i in A:
	if sqrt(i) == int(sqrt(i)) and primes[int(sqrt(i))]:
		print('YES\n')
	else:
		print('NO\n')


from math import sqrt
MAXN = 1000001
prime = [True for i in range(MAXN + 1)]
p = 2
while p * p <= MAXN:
	if prime[p]:
		for i in range(p * p, MAXN + 1, p):
			prime[i] = False
	p += 1
prime[0] = False
prime[1] = False
input()
for n in map(int, input().split()):
	n = sqrt(n)
	if n == int(n):
		if prime[int(n)]:
			print('YES')
			continue
	print('NO')


def prime(x):
	for i in range(2, int(x ** 0.5) + 1):
		if x % i == 0:
			return 0
	return 1
n = int(input())
l = list(map(int, input().split()))
for i in l:
	if prime(int(i ** 0.5)) == 1 and int(i ** 0.5) == i ** 0.5 and (i != 1):
		print('YES')
	else:
		print('NO')


input()
a = map(int, input().split())
N = 1000001
sieve = [0] + [1] * (N // 2 + 1)
res = {4}
for j in range(1, N // 2 + 1):
	if sieve[j]:
		p = 2 * j + 1
		res.add(p * p)
		for i in range(p * p, N, 2 * p):
			sieve[i // 2] = 0
for v in a:
	print(['NO', 'YES'][v in res])


a = [0, 0] + list(range(2, 10 ** 6 + 1))
for i in range(2, 10 ** 3 + 1):
	if a[i]:
		for j in range(i * 2, 10 ** 6 + 1, i):
			a[j] = 0
b = set((x * x for x in a if x))
n = int(input())
l = list(map(int, input().split()))
ans = []
for x in l:
	if x in b:
		ans += ['YES']
	else:
		ans += ['NO']
print('\n'.join(ans))


def is_prime():
	prime = [True] * 1000000
	prime[0] = False
	prime[1] = False
	for i in range(2, 1000000):
		if prime[i] == True:
			for j in range(i * i, 1000000, i):
				prime[j] = False
	return prime

def is_tprime(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	raiz = n ** 0.5
	if raiz == int(raiz):
		if is_prime[int(raiz)] == True:
			return True
	return False
is_prime = is_prime()
total_numbers = int(input())
numbers = [int(k) for k in input().split()]
for i in numbers:
	if is_tprime(i) == False:
		print('NO')
	else:
		print('YES')


import math

def isPrime(n):
	if n == 1:
		return False
	if n == 2:
		return True
	elif n % 2 == 0:
		return False
	else:
		for i in range(3, math.floor(math.sqrt(n)) + 1, 2):
			if n % i == 0:
				return False
	return True
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	r = int(math.sqrt(a[i]))
	s = r * r
	if a[i] != s:
		print('NO')
	elif isPrime(r):
		print('YES')
	else:
		print('NO')


from math import sqrt
from math import ceil

def count_divisor(temp):
	num = sqrt(temp)
	if num - ceil(num) == 0:
		num = int(num)
		i = 2
		while i * i <= num:
			if num % i == 0:
				return False
			i += 1
		return True
	else:
		return False

def main():
	input()
	a = list(map(int, input().split()))
	for i in a:
		if count_divisor(i) and i != 1:
			print('YES')
		else:
			print('NO')
main()


from math import sqrt
n = int(input())
arr = [int(i) for i in input().split()]
for x in arr:
	root = int(sqrt(x))
	if root ** 2 == x and (root == 2 or root % 2 == 1) and (1 < root):
		flag = True
		rr = int(sqrt(root)) + 1
		for i in range(3, rr, 2):
			if root % i == 0:
				flag = False
				break
	else:
		flag = False
	res = 'YES' if flag else 'NO'
	print(res)


n = 2 ** 20
a = [1] * n
sq = {4}
for i in range(2, n):
	if a[i]:
		for j in range(i * i, n, i):
			a[j] = 0
		sq.add(i * i)
__ = input()
for x in map(int, input().split()):
	if x in sq:
		print('YES')
	else:
		print('NO')


import math
import sys
std = sys.stdin
n = int(std.readline())
data = [int(x) for x in std.readline().rstrip('\n').split()]
m = math.floor(max(data) ** 0.5)
T = [True] * (m + 1)
T[0] = False
T[1] = False
for i in range(2, math.ceil(m ** 0.5) + 1):
	for j in range(i * i, m + 1, i):
		T[j] = False
for x in data:
	l = math.floor(x ** 0.5)
	if T[l]:
		if l * l == x:
			sys.stdout.write('YES\n')
		else:
			sys.stdout.write('NO\n')
	else:
		sys.stdout.write('NO\n')


n = int(input())
san = [1] * 1000001
san[0] = 0
san[1] = 0
for i in range(2, 1000001):
	if san[i]:
		for j in range(i * i, 1000001, i):
			san[j] = 0
for i in map(int, input().split()):
	if int(i ** 0.5) != i ** 0.5:
		print('NO')
		continue
	elif san[int(i ** 0.5)] == 1:
		print('YES')
		continue
	else:
		print('NO')


import math
с = int(input())
numbers = list(map(int, input().split()))
PRIME_COUNT = 10 ** 6
is_prime = [True] * PRIME_COUNT
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(2, 1000):
	if is_prime[i]:
		for j in range(i * i, PRIME_COUNT, i):
			is_prime[j] = False
for elem in numbers:
	q = math.sqrt(elem)
	if not q.is_integer() or q >= 1000000 or (not is_prime[int(q)]):
		print('NO')
	else:
		print('YES')


import math
n = int(input())
a = [int(i) for i in input().split(' ')]
maxx = 0
for i in a:
	if i > maxx:
		maxx = i
prost = []
maxx = int(math.sqrt(maxx))
for i in range(maxx + 1):
	prost.append(i)
prost[0] = -1
if len(prost) > 1:
	prost[1] = -1
for i in range(int(math.sqrt(maxx)) + 1):
	if prost[i] != -1:
		for j in range(prost[i] * prost[i], maxx + 1, prost[i]):
			prost[j] = -1
prost2 = set([])
for i in prost:
	if i != -1:
		prost2.add(i)
prost = prost2
for i in range(n):
	if math.sqrt(a[i]) in prost:
		print('YES')
	else:
		print('NO')


import math
import sys
MX = 10 ** 6
isprime = [1] * (MX + 5)
prime = []

def sieve():
	isprime[0] = isprime[1] = 0
	prime.append(2)
	i = 4
	while i <= MX:
		isprime[i] = 0
		i += 2
	i = 3
	while i * i <= MX:
		j = i * i
		while j <= MX:
			isprime[j] = 0
			j += 2 * i
		i += 2
	i = 3
	while i <= MX:
		if isprime[i] == 1:
			prime.append(i)
		i += 2

def main():
	sieve()
	n = int(input())
	s = set()
	for val in prime:
		s.add(val * val)
	a = list(map(int, input().split()))
	for val in a:
		if val in s:
			print('YES')
		else:
			print('NO')
main()


from sys import stdin
import math

def get_user_input():
	return list(map(int, stdin.readline().rstrip().split()))
all_num = [0] * 10000001
all_num[1] = 1
all_num[2] = 0
for i in range(2, 1001, 1):
	if all_num[i]:
		continue
	for j in range(2 * i, 1000001, i):
		all_num[j] = 1
n = int(input())
input_list = get_user_input()
for i in range(0, len(input_list)):
	sqr = int(math.sqrt(input_list[i]))
	if sqr * sqr == input_list[i] and (not all_num[sqr]):
		print('YES')
	else:
		print('NO')


def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	prime[1] = False
	return prime
int(input())
a = tuple(map(int, input().split()))
p = SieveOfEratosthenes(int(max(a) ** 0.5))
for i in a:
	print('YES') if not i ** 0.5 % 1 and p[int(i ** 0.5)] else print('NO')


lim = 1000009
ifprime = [True] * lim
ifprime[0] = False
ifprime[1] = False
for i in range(2, lim):
	if ifprime[i] == True:
		for j in range(i * 2, lim, i):
			ifprime[j] = False
n = int(input())
a = list(map(int, input().split(' ')))

def fn(x):
	if x ** 0.5 == int(x ** 0.5):
		if ifprime[int(x ** 0.5)] == True:
			return 'YES'
		if x == 1:
			return 'NO'
	return 'NO'
for i in a:
	print(fn(i))


from math import sqrt

def is_prime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def is_perfect_square(n):
	return int(sqrt(n) + 0.5) ** 2 == n

def is_t_prime(n):
	if is_perfect_square(n):
		if is_prime(round(sqrt(n))):
			return True
		else:
			return False
	else:
		return False
input()
for n in map(int, input().split()):
	if is_t_prime(n):
		print('YES')
	else:
		print('NO')


import math
n = int(input())
l = [int(x) for x in input().split()]

def sieve_of_eratosthenes(n):
	primes = [True] * (n + 1)
	p = 2
	while p <= n:
		if primes[p]:
			for i in range(p * 2, n + 1, p):
				primes[i] = False
		p += 1
	return primes
list_1 = sieve_of_eratosthenes(int(math.sqrt(max(l))) + 1)
for i in range(n):
	m = int(math.sqrt(l[i]))
	if l[i] == 1 or l[i] == 2:
		print('NO')
		continue
	if m * m == l[i] and list_1[m] == True:
		print('YES')
	else:
		print('NO')


import math
prime = [True] * 1000001

def check(x):
	t = int(math.sqrt(x))
	return t * t == x and x > 1 and prime[t]
for i in range(2, 1000001):
	if prime[i]:
		for j in range(i * i, 1000001, i):
			prime[j] = False
n = int(input())
x = list(map(int, input().split()))
ans = map(lambda a: 'YES' if check(a) else 'NO', x)
print(*ans, sep='\n')


import os
import sys
from math import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def array():
	return [int(i) for i in input().split()]
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def prime(n):
	pr = [True] * (n + 1)
	pr[1] = False
	p = 2
	while p * p <= n:
		if pr[p] == True:
			for j in range(p * p, n + 1, p):
				pr[j] = False
		p += 1
	return pr
pri = prime(1000000)
n = int(input())
a = array()
for i in a:
	sq = sqrt(i)
	if sq == int(sq) and pri[int(sq)] == 1:
		print('YES')
	else:
		print('NO')


def prime(n):
	if n <= 1:
		return 0
	if n <= 3:
		return 1
	if n % 2 == 0 or n % 3 == 0:
		return 0
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return 0
		i = i + 6
	return 1
n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	if a[i] == 4:
		print('YES')
	elif a[i] % 2 == 0:
		print('NO')
	else:
		res = int(a[i] ** 0.5)
		if res * res == a[i]:
			if prime(res) == 1:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


primes = [False] * 2 + [True] * 999999
for p in range(2, 1000):
	if primes[p]:
		for i in range(2 * p, 1000001, p):
			primes[i] = False
n = int(input())
lst = list(map(int, input().split()))
for each in lst:
	a = each
	b = int(a ** 0.5)
	if a == b ** 2 and a != 1 and primes[b]:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math

def solve():
	tprime = sieve(10 ** 6)
	n = int(input())
	a = list(map(int, input().split()))
	for x in a:
		val = x ** 0.5
		if val == int(val):
			if tprime[int(val)]:
				print('YES')
				continue
		print('NO')
for _ in range(1):
	solve()


d1 = {}

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n):
		if prime[p]:
			d1[p] = 1
SieveOfEratosthenes(10 ** 6 + 1)
n = int(input())
l1 = list(map(int, input().split()))
for i in range(0, n):
	x = l1[i]
	if int(x ** 0.5) ** 2 == x:
		if int(x ** 0.5) in d1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math as m

def cp(n):
	r = 0
	for i in range(2, int(m.sqrt(n)) + 1):
		if n % i == 0:
			r = 1
			break
	if r == 1:
		print('NO')
	else:
		print('YES')
n = input()
a = list(map(int, input().split()))
for i in a:
	z = m.sqrt(i)
	if z == int(z) and z != 1:
		cp(int(z))
	else:
		print('NO')


import math
n = int(input())
m = int(1000000.0 + 10)
a = list(map(int, input().split()))
res = []
sieve = [1] * m
for i in range(2, m):
	if sieve[i] == 1:
		for j in range(i * i, m, i):
			sieve[j] = 0
for x in a:
	sq = math.sqrt(x)
	if x == 1:
		res.append('NO')
	elif sq == int(sq) and sieve[int(sq)] == 1:
		res.append('YES')
	else:
		res.append('NO')
for x in res:
	print(x)


def isPrime(n):
	if n <= 1:
		return False
	elif n <= 3:
		return True
	elif n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i += 6
	return True
_ = int(input())
arr = list(map(int, input().split()))
for k in arr:
	m = k ** 0.5
	if m == int(m):
		if isPrime(int(m)):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
nums = list(map(int, input().split()))

def sqprime(n):
	p = [1] * (2 + (n - 3) // 2)
	i = 1
	while i < len(p) and (1 + 2 * i) * (1 + 2 * i) <= n:
		if p[i] != 0:
			x = 1 + 2 * i
			j = x * x // 2
			while j < len(p):
				p[j] = 0
				j = j + x
		i = i + 1
	ans = [4]
	i = 1
	while i < len(p):
		if p[i] != 0:
			x = 1 + 2 * i
			ans.append(x * x)
		i = i + 1
	return ans

def bsearch(arr, x):
	s = 0
	e = len(arr)
	while True:
		m = (s + e) // 2
		if x == arr[m]:
			return 'YES'
		elif x < arr[m]:
			e = m
		elif x > arr[m]:
			s = m
		mn = (s + e) // 2
		if mn == m:
			break
	return 'NO'
a = sqprime(100 + 10 ** 6)
for x in nums:
	print(bsearch(a, x))


from math import sqrt as sqrt
n = int(input())
a = list(map(int, input().split()))
n = 10 ** 6
ispr = [1] * (n + 1)
ispr[1] = 0
for i in range(2, int(n ** 0.5) + 1):
	if ispr[i]:
		for j in range(2 * i, n + 1, i):
			ispr[j] = 0
for i in a:
	if i == 1:
		print('NO')
		continue
	sq = sqrt(i)
	if sq != int(sq):
		print('NO')
	elif ispr[int(sq)]:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
xs = [int(x) for x in input().split()]
mx = max(xs)
r = int(math.sqrt(mx))
sieve = [True] * (r + 1)
sieve[0] = False
sieve[1] = False
if r >= 2:
	for i in range(2, r // 2 + 1):
		sieve[i * 2] = False
if r >= 3:
	for i in range(2, r // 3 + 1):
		sieve[i * 3] = False
if r >= 5:
	for i in range(5, r + 1, 2):
		if sieve[i]:
			for j in range(2 * i, r + 1, i):
				sieve[j] = False
for x in xs:
	root = int(math.sqrt(x))
	if root * root == x and sieve[root]:
		print('YES')
	else:
		print('NO')


from functools import reduce
import math

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def loadinput():
	n = int(input())
	nums = list(map(int, input().split()))
	return (n, nums)

def primes1(n):
	sieve = [True] * (n // 2)
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i // 2]:
			sieve[i * i // 2::i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [2 * i + 1 for i in range(1, n // 2) if sieve[i]]

def is_prime(n):
	if n == 2:
		return True
	if n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for divisor in range(3, sqr, 2):
		if n % divisor == 0:
			return False
	return True
limit = 1000000

def calculate_prime_flag_for_each_number_upto_limit():
	prime_flag = [True] * limit
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, limit):
		if prime_flag[i] == True:
			for j in range(i * i, limit, i):
				prime_flag[j] = False
	return prime_flag

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def check_if_a_number_is_t_prime(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if prime_flag[int(sqrt_n)] == True:
			return True
	return False
prime_flag = calculate_prime_flag_for_each_number_upto_limit()
(k, nums) = loadinput()
for n in nums:
	if check_if_a_number_is_t_prime(n):
		print('YES')
	else:
		print('NO')


import math

def prime(k):
	if k <= 1:
		return False
	if k <= 3:
		return True
	if k % 2 == 0 or k % 3 == 0:
		return False
	i = 5
	while i * i <= k:
		if k % i == 0 or k % (i + 2) == 0:
			return False
		i += 6
	return True
n = int(input())
l = list(map(int, input().split()))
for j in l:
	if j == 1:
		print('NO')
		continue
	k = math.sqrt(j)
	if k - math.floor(k) == 0:
		k = int(k)
		if prime(k):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


x = 10 ** 6
s = [1 for i in range(x + 1)]
s[0] = 0
s[1] = 0

def sieve(x):
	for i in range(2, int(x ** 0.5) + 1):
		if s[i] == 1:
			for j in range(i * i, x + 1, i):
				s[j] = 0
sieve(x)
n = int(input())
x = list(map(int, input().split()))
for i in range(n):
	a = x[i]
	if (a ** 0.5).is_integer() and s[int(a ** 0.5)] == 1:
		print('YES')
	else:
		print('NO')


def tPrime():
	n = 10 ** 6
	isPrime = [True for i in range(n + 1)]
	i = 2
	while i * i <= n:
		if isPrime[i]:
			j = i * i
			while j <= n:
				isPrime[j] = False
				j += i
		i += 1
	tPrime = set([i * i for i in range(2, n + 1) if isPrime[i]])
	return tPrime
tPrimes = tPrime()
n = int(input())
arr = ['YES' if int(_) in tPrimes else 'NO' for _ in input().strip().split()]
for res in arr:
	print(res)


p = input()
b = map(int, input().split())
a = [True for i in range(10 ** 6 + 1)]
a[0] = False
a[1] = False
for i in range(2, 10 ** 3):
	if a[i]:
		for j in range(i * i, 10 ** 6 + 1, i):
			a[j] = False
a = set([i * i for i in range(len(a)) if a[i]])
for i in b:
	if i in a:
		print('YES')
	else:
		print('NO')


n = int(input())
mas = list(map(int, input().split()))
for i in mas:
	kk = int(i ** 0.5)
	if kk * kk == i:
		pr = 'YES'
		for j in range(2, kk + 1):
			if j * j <= kk:
				if kk % j == 0:
					pr = 'NO'
					break
			else:
				break
		if i == 1:
			pr = 'NO'
		print(pr)
	else:
		print('NO')


import math
n = int(input())
a = list(map(int, input().split()))
sieve = [1] * 1000001
(sieve[0], sieve[1]) = (0, 0)
for i in range(int(math.sqrt(1000000)) + 1):
	if sieve[i]:
		j = i + i
		while j < 1000001:
			sieve[j] = 0
			j += i
for e in a:
	e1 = int(math.sqrt(e))
	if e1 * e1 == e and sieve[e1]:
		print('YES')
	else:
		print('NO')


import math

def primes(k):
	if k % 2 == 0 and k != 2:
		return False
	for i in range(3, int(math.sqrt(k)) + 1, 2):
		if k % i == 0:
			return False
	return True

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
q = SieveOfEratosthenes(10 ** 6 + 1)
n = int(input())
l = list(map(int, input().strip().split()))
for i in l:
	if math.sqrt(i) == int(math.sqrt(i)) and i != 1:
		if q[int(math.sqrt(i))]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
import math as mt
input = sys.stdin.buffer.readline
mod = 998244353

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def isPrime(n):
	if n <= 1:
		return False
	for i in range(2, n):
		if n % i == 0:
			return False
	return True

def printPrime(n):
	p = []
	for i in range(2, n + 1):
		if isPrime(i):
			p.append(i)
	return p
MAXN = 1000000
spf = [0 for i in range(MAXN)]

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
t = 1
sieve()
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	for i in range(n):
		x = int(mt.sqrt(l[i]))
		if x * x == l[i] and x != 10 ** 6:
			if spf[x] == x and x != 1:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


import math
n = int(input())
li = list(map(int, input().split()))

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
p = SieveOfEratosthenes(1000000)
for i in range(len(li)):
	j = math.ceil(math.sqrt(li[i]))
	if j == 1:
		print('NO')
	elif j * j == li[i] and p[j] == True:
		print('YES')
	else:
		print('NO')


import math

def sieve(num):
	primes = [True for i in range(num)]
	(primes[0], primes[1]) = (False, False)
	for i in range(2, num):
		if primes[i]:
			for j in range(i * 2, num, i):
				primes[j] = False
	return primes

def tprime(num):
	root = math.sqrt(num)
	if root % 1 != 0.0:
		return 'NO'
	if primes[int(root)]:
		return 'YES'
	return 'NO'
n = int(input())
nums = [int(x) for x in input().split()]
primes = sieve(1000010)
for num in nums:
	print(tprime(num))


n = input()
q = list(map(int, input().split()))
for i in q:
	if i == 1:
		print('NO')
		continue
	a = i ** 0.5
	if a % 1 == 0:
		for j in range(2, int(a ** 0.5 + 1)):
			if int(a) % j == 0:
				print('NO')
				break
		else:
			print('YES')
	else:
		print('NO')


def oular2(x):
	l1 = [0, 0] + [1 for i in range(x - 1)]
	l2 = list(range(2, int(x ** 0.5) + 2))
	for i in l2:
		if l1[i]:
			for j in range(i * i, x + 1, i):
				l1[j] = 0
				if i % j == 0:
					break
	return l1
line = int(input())
n = [int(x) for x in input().split()]
l = oular2(int(max(n) ** 0.5) + 1)
for i in n:
	if i ** 0.5 == int(i ** 0.5) and l[int(i ** 0.5)]:
		print('YES')
	else:
		print('NO')


from math import sqrt
n = int(input())
l = list(map(int, input().split()))

def prime_sieve():
	arr = [True for i in range(1000003)]
	arr[1] = False
	for i in range(2, 1002):
		if arr[i]:
			for k in range(2 * i, 1000003, i):
				arr[k] = False
	return arr
primes = prime_sieve()
for n in l:
	root = int(sqrt(n))
	if root == 1:
		print('NO')
	elif root ** 2 == n:
		if primes[root]:
			print('YES')
		else:
			print('NO')
	elif (root + 1) ** 2 == n:
		if primes[root + 1]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


li_pri = [True] * (10 ** 6 + 1)
li_pri[0] = li_pri[1] = False
comm = []
for i in range(2, 10 ** 6 + 1):
	if li_pri[i]:
		comm.append(i)
	for j in comm:
		if i * j > 10 ** 6:
			break
		li_pri[i * j] = False
		if i % j == 0:
			break
n = int(input())
li = list(map(int, input().split(' ')))
for i in li:
	a = int(i ** 0.5)
	if a ** 2 == i:
		if li_pri[a]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
n = int(input())
a = map(int, input().split())
for num in a:
	rt = sqrt(num)
	if rt == int(rt) and isPrime(int(rt)):
		print('YES')
	else:
		print('NO')


hat = int(input())
lst = [int(x) for x in input().split()]
limit = 1000000

def Prime():
	primeFlag = [True] * limit
	primeFlag[0] = primeFlag[1] = False
	for i in range(2, limit):
		if primeFlag[i]:
			for j in range(i * i, limit, i):
				primeFlag[j] = False
	return primeFlag
primeflag = Prime()
for i in lst:
	if i == 4:
		print('YES')
	elif i % 2 == 0 or i == 1:
		print('NO')
	else:
		sq = i ** 0.5
		if sq == int(sq):
			if primeflag[int(sq)] == True:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


def prime(n):
	primes = [True for i in range(n + 1)]
	primes[1] = 0
	val = 2
	while val * val <= n:
		if primes[val] == 1:
			for i in range(val * val, n + 1, val):
				primes[i] = 0
		val += 1
	return primes
n = int(input())
L = [int(i) for i in input().split()]
arr = prime(10 ** 6)
for i in L:
	root = i ** 0.5
	if root == int(root):
		if arr[int(root)] == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def Sieve(n):
	prime = [True] * (n + 1)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	return prime
n = int(input())
arr = list(map(int, input().split()))
x = []
val = Sieve(10 ** 6)
for i in range(len(arr)):
	if arr[i] ** 0.5 == int(arr[i] ** 0.5):
		if val[int(arr[i] ** 0.5)]:
			x.append('YES')
		else:
			x.append('NO')
	else:
		x.append('NO')
for i in range(len(x)):
	print(x[i])


import math

def SieveOfEratosthenes(n):
	s = set()
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n):
		if prime[p]:
			s.add(p)
	return s
nu = int(input())
l = list(map(int, input().split()))
S = SieveOfEratosthenes(10 ** 6 + 1)
for n in l:
	x = int(math.sqrt(n))
	if n == 1:
		print('NO')
	elif x * x != n:
		print('NO')
	elif x in S:
		print('YES')
	else:
		print('NO')


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	n = iin()
	l = ain()
	s = SieveOfEratosthenes(10 ** 6)
	for i in l:
		if i <= 3:
			print('NO')
		elif i % 2 == 0:
			if i == 4:
				print('YES')
			else:
				print('NO')
		else:
			x = i ** 0.5
			if int(x) == x:
				if int(x) in s:
					print('YES')
				else:
					print('NO')
			else:
				print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


N = 1000005
siv = [0] * N
pp = set()
for i in range(2, N):
	if not siv[i]:
		for j in range(i * i, N, i):
			siv[j] = i
		pp |= {i * i}
n = int(input())
ar = list(map(int, input().split()))
sol = ['YES' if x in pp else 'NO' for x in ar]
for s in sol:
	print(s)


def Sieve_Of_Erasthonoes(n):
	x = [False] * 2
	x = x + [True] * n
	for i in range(2, n):
		if x[i]:
			for j in range(i ** 2, n + 1, i):
				x[j] = False
	return x
input()
z = input()
a = list(map(int, z.split()))
check = Sieve_Of_Erasthonoes(int(max(a) ** 0.5) + 1)
for i in a:
	r = int(i ** 0.5)
	if check[r] and r * r == i:
		print('YES')
	else:
		print('NO')


def gen_primes(upper_bound):
	upper_bound += 1
	t = [0] * upper_bound
	primes = [2]
	for i in range(3, upper_bound, 2):
		if t[i]:
			continue
		primes.append(i)
		for j in range(i + i, upper_bound, i):
			t[j] = 1
	return primes

def main():
	tprimes = set([p * p for p in gen_primes(int(1000000.0))])
	_ = input()
	x = list(map(int, input().split()))
	print('\n'.join(('YES' if i in tprimes else 'NO' for i in x)))
main()


import math
n = input()
l = list(map(int, input().split()))
mx = int(1000000.0)
num = [1 for _ in range(mx + 1)]
num[1] = 0
run = int(math.sqrt(mx))
for i in range(2, run + 1):
	cur = i * 2
	if num[i] == 1:
		while cur <= mx:
			num[cur] = 0
			cur += i
for v in l:
	c = int(math.sqrt(v))
	if c * c == v and num[c] == 1:
		print('YES')
	else:
		print('NO')


import math
is_primes = [True for _ in range(1000001)]
for i in range(2, 1000001):
	if is_primes[i]:
		for j in range(i * i, 1000001, i):
			is_primes[j] = False
is_primes[1] = False
n = int(input())
arr = map(int, input().split())
r = ''
for x in arr:
	if math.sqrt(x) == int(math.sqrt(x)) and is_primes[int(math.sqrt(x))]:
		r += 'YES\n'
	else:
		r += 'NO\n'
print(r)


n = int(input())
x = input()
y = x.split()
t = 1000000
p = [True] * (t + 1)
a = 2
while a * a <= t:
	if p[a] == True:
		for i in range(a * 2, t + 1, a):
			p[i] = False
	a = a + 1
for k in range(0, len(y)):
	u = int(y[k])
	v = u ** 0.5
	if u == 1:
		print('NO')
	elif v % 1 == 0:
		if p[round(v)] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
num = [int(x) for x in input().split()]
maxm = max(num)
maxm = int(math.sqrt(maxm + 1))
p = {}
for i in range(2, maxm + 1):
	if i not in p:
		p[i] = 1
		j = 2
		while j * i <= maxm:
			p[i * j] = 0
			j += 1
for i in range(0, n):
	ans = int(math.sqrt(num[i]))
	if ans * ans != num[i] or ans not in p or p[ans] == 0:
		print('NO')
	else:
		print('YES')


def isprime(x):
	if x == 1 or x == 0:
		return 'NO'
	if x == 2:
		return 'YES'
	for i in range(2, int(math.sqrt(x)) + 1):
		if x % i == 0:
			return 'NO'
	return 'YES'
import math
n = int(input())
l = list(map(int, input().split()))
for i in l:
	a = math.sqrt(i)
	if a == int(a):
		print(isprime(int(a)))
	else:
		print('NO')


n = 1000000
prime = [1] * (n + 1)
for i in range(4, n + 1):
	if i % 2 == 0:
		prime[i] = 0
prime[0] = prime[1] = 0
for i in range(3, n + 1):
	if prime[i] == 1:
		for j in range(i * i, n + 1, i):
			prime[j] = 0
n = int(input())
lst = list(map(int, input().split()))
for i in lst:
	if i ** 0.5 == int(i ** 0.5) and prime[int(i ** 0.5)] == 1:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
nums = list(map(int, input().split()))
l = [1] * 1000001
l[1] = 0
for i in range(2, int(math.sqrt(1000000)) + 1):
	if l[i] == 1:
		for j in range(i * i, 1000001, i):
			l[j] = 0
for x in nums:
	r = int(math.sqrt(x))
	if r * r == x and l[r] == 1:
		print('YES')
	else:
		print('NO')


def tprimes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	tprimes = {}
	for p in range(2, n):
		if prime[p]:
			tprimes[p ** 2] = 0
	return tprimes
tprimes_ = tprimes(10 ** 6)
n = int(input())
m = map(int, input().split())
r = ['YES' if e in tprimes_ else 'NO' for e in m]
print('\n'.join(r))


prime = [2]
for i in range(1007):
	s1 = int((i + 3) ** 0.5)
	count = 0
	for j in range(s1 - 1):
		if (i + 3) % (j + 2) == 0:
			break
		else:
			count += 1
	if count == s1 - 1:
		prime.append(i + 3)
n = int(input())
numberlist = [int(x) for x in input().split()]
for i in range(n):
	count = 0
	num = numberlist[i]
	s1 = int(num ** 0.5)
	if s1 ** 2 == num:
		s2 = int(s1 ** 0.5)
		if s2 == 1 and s1 == 1:
			print('NO')
		elif s2 == 2 and s1 % 2 == 0:
			print('NO')
		elif s2 > 2:
			rank = 0
			while s2 >= prime[rank]:
				if s1 % prime[rank] == 0:
					print('NO')
					break
				else:
					rank += 1
			else:
				print('YES')
		else:
			print('YES')
	else:
		print('NO')


def binarySearch(arr, l, r, x):
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return 1
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return 0

def Sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	list1 = []
	for p in range(2, n):
		if prime[p]:
			list1.append(p ** 2)
	return list1
list1 = Sieve(1000000)
n = int(input())
list2 = list(map(int, input().split()))
for i in range(n):
	if binarySearch(list1, 0, len(list1) - 1, list2[i]):
		print('YES')
	else:
		print('NO')


mem = {}
n = 10 ** 6
prime = [True for i in range(n + 1)]
p = 2
while p * p <= n:
	if prime[p] == True:
		for i in range(p * p, n + 1, p):
			prime[i] = False
	p += 1
for p in range(2, n):
	if prime[p]:
		mem[p ** 2] = 1
num = int(input())
arr = list(map(int, input().split()))
for i in arr:
	if i in mem:
		print('YES')
	else:
		print('NO')


def prime(n):
	v = int(n ** 0.5) + 1
	l = [True for i in range(n + 1)]
	l[0] = False
	l[1] = False
	for i in range(2, v):
		if l[i]:
			for j in range(i, n + 1, i):
				if j > i and l[j]:
					l[j] = False
	return l

def div3(n):
	v = int(n ** 0.5)
	if v ** 2 == n:
		if table[v]:
			return 'YES'
		else:
			return 'NO'
	else:
		return 'NO'
n = int(input())
a = list(map(int, input().split()))
maxv = int(max(a) ** 0.5)
table = prime(maxv)
a = map(div3, a)
for i in a:
	print(i)


n = int(input())
arr = list(map(int, input().split()))
max_value = max(arr)
limit = int(pow(max_value, 1 / 2) + 1)
aux = limit * [True]

def sieve():
	p = 2
	while p * p < limit:
		if aux[p]:
			for i in range(p * p, limit, p):
				aux[i] = False
		p += 1

def is_tprime(num):
	if num < limit and aux[num]:
		return False
	sqrt = pow(num, 1 / 2)
	if sqrt != int(sqrt):
		return False
	return aux[int(sqrt)]
sieve()
for num in arr:
	if is_tprime(num):
		print('YES')
	else:
		print('NO')


n = int(input())
prime = [True] * 1000001
prime[0] = False
prime[1] = False
for i in range(2, 1001):
	if prime[i]:
		for j in range(i * i, 1000001, i):
			prime[j] = False
l = list(map(int, input().split()))
for i in l:
	b = int(i ** 0.5)
	if i ** 0.5 == int(i ** 0.5) and prime[int(i ** 0.5)]:
		print('YES')
	else:
		print('NO')


resheto = [True] * (10 ** 6 + 1)
sus = set()
for p in range(2, 10 ** 3 + 1):
	if resheto[p]:
		for d in range(2 * p, 10 ** 6 + 1, p):
			resheto[d] = False
for i in range(2, 10 ** 6 + 1):
	if resheto[i]:
		sus.add(i ** 2)
input()
for i in list(map(int, input().split())):
	if i in sus:
		print('YES')
	else:
		print('NO')


primes = []
UPB = 1000001
flags = [False] * UPB
p = 2
while True:
	for i in range(p * p, UPB, p):
		flags[i] = True
	primes.append(p)
	p += 1
	while p < UPB and flags[p]:
		p += 1
	if p >= UPB:
		break
tprimes = {v * v for v in primes}
input()
result = (('NO', 'YES')[v in tprimes] for v in map(int, input().split()))
print('\n'.join(result))


limit = 1000002
primes = [1, 1] + [0] * limit
for i in range(2, limit):
	if 1 - primes[i]:
		for j in range(i * i, limit, i):
			primes[j] = 1
n = int(input())
arr = list(map(int, input().strip().split()))
for i in arr:
	root = int(i ** (1 / 2))
	if root * root != i or primes[root]:
		print('NO')
	else:
		print('YES')


def si(r):
	prime = [True] * (r + 1)
	command = []
	prime[1] = False
	for i in range(2, r + 1):
		if prime[i]:
			command.append(i)
		for a in command:
			if i * a > r:
				break
			prime[i * a] = False
			if i % a == 0:
				break
	return prime
n = int(input())
judge = si(1000009)
num = [int(x) for x in input().split()]
for t in num:
	if t ** 0.5 % 1 != 0:
		print('NO')
		continue
	elif t ** 0.5 % 1 == 0:
		y = int(t ** 0.5)
		if judge[y]:
			print('YES')
			continue
		else:
			print('NO')
			continue


import math
n = 10 ** 6
composite = [False] * (n + 1)
primes = {}
for i in range(2, n + 1):
	if not composite[i]:
		primes[i] = True
		for j in range(i * i, n + 1, i):
			composite[j] = True
i = int(input())
tab = [int(x) for x in input().split()]
for x in tab:
	if math.sqrt(x) in primes:
		print('YES')
	else:
		print('NO')


def primes(n):
	p = [True] * (n + 1)
	p[0] = p[1] = False
	i = 4
	while i <= n:
		p[i] = False
		i += 2
	i = 3
	while i * i <= n:
		if p[i]:
			j = i * i
			while j <= n:
				p[j] = False
				j += i
		i += 2
	return p
p = primes(10 ** 6)
n = int(input())
for i in map(int, input().split()):
	x = int(i ** 0.5)
	ans = i ** 0.5 - x < 1e-10 and p[x]
	print(['NO', 'YES'][ans])


def prime(n):
	s = [0] * 2 + [1] * n
	for i in range(2, int(n ** 0.5) + 2):
		if s[i] == 1:
			for t in range(2, int(n / i) + 1):
				s[t * i] = 0
	return s
l = prime(1000000)
n = int(input())
s = list(map(int, input().split()))
for i in s:
	if i ** 0.5 == int(i ** 0.5):
		if l[int(i ** 0.5)] == 1:
			print('YES')
			continue
	print('NO')


su = [True for i in range(1000000)]
r = set()
for i in range(2, 1000000):
	if su[i]:
		for j in range(i * i, 1000000, i):
			su[j] = False
		r.add(i * i)
n = int(input())
line = [int(x) for x in input().split()]
for a in line:
	if a in r:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
lst = list(map(int, input().split()))
maxnum = int(math.sqrt(max(lst)))
new = [1] * (maxnum + 1)
new[0] = 0
new[1] = 0
for j in range(2, int(math.sqrt(maxnum)) + 1):
	if new[j] == 1:
		for p in range(j * j, maxnum + 1, j):
			new[p] = 0
allprime = []
for l in range(len(new)):
	if new[l] == 1:
		allprime.append(l)
for i in lst:
	A = math.sqrt(i)
	if A == int(A) and new[int(A)] == 1:
		print('YES')
	else:
		print('NO')


from math import sqrt, ceil

def isprime(n):
	for x in range(2, ceil(sqrt(n)) + 1):
		if n % x == 0 and n != x:
			return False
	return True
n = int(input())
a = list(map(int, input().split()))
h = max(a)
primes = {}
for x in range(2, ceil(sqrt(h)) + 1):
	if isprime(x):
		primes[x * x] = 1
for x in a:
	if x in primes:
		print('YES')
	else:
		print('NO')


from sys import stdin, stderr

def readInts():
	return map(int, stdin.readline().strip().split())

def print_err(*args, **kwargs):
	print(*args, file=stderr, **kwargs)

def solve(vs):
	return None

def tprimes():
	ps = [True for _ in range(10 ** 6 + 1)]
	for pt in range(4, 10 ** 6 + 1, 2):
		ps[pt] = False
	ps[0] = False
	ps[1] = False
	for pt in range(3, 10 ** 6 + 1):
		if pt * pt > 10 ** 6:
			break
		if not ps[pt]:
			continue
		ptx = 3 * pt
		while ptx <= 10 ** 6:
			ps[ptx] = False
			ptx += 2 * pt
	tps = set((p * p for p in range(10 ** 6 + 1) if ps[p]))
	return tps

def run():
	(n,) = readInts()
	tps = tprimes()
	for v in readInts():
		if v in tps:
			print('YES')
		else:
			print('NO')
run()


l = 1000002
z = [1, 1] + [0] * l
for i in range(1, l):
	if z[i] == 0:
		z[i * i::i] = [1] * (l // i - i + 1)
n = int(input())
for i in map(int, input().split()):
	s = int(i ** 0.5)
	print('YNEOS'[i != s * s or z[s]::2])


n = int(input())

def isprime(n):
	if n <= 1:
		return False
	if n == 2 or n == 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	m = int(n ** 0.5) + 1
	for i in range(5, m, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True
L = list(map(int, input().split()))
for i in L:
	a = int(i ** 0.5)
	if a * a == i and isprime(a):
		print('YES')
	else:
		print('NO')


import math
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()

def s(a):
	print(''.join(list(map(str, a))))

def soe(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
n = I()
a = L()
l = soe(1000000)
for i in a:
	if i == 4:
		print('YES')
	elif i % 2 == 0 or i < 4:
		print('NO')
	elif math.sqrt(i) == int(math.sqrt(i)):
		if l[int(math.sqrt(i))] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
import os
import random
import re
import sys
limit = 1000000

def calculate_prime():
	prime_flag = [True] * limit
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, limit):
		if prime_flag[i] == True:
			for j in range(i * i, limit, i):
				prime_flag[j] = False
	return prime_flag

def check(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if prime_flag[int(sqrt_n)] == True:
			return True
	return False
prime_flag = calculate_prime()
total_numbers = int(input())
input_array = list(map(int, input().split()))
for i in input_array:
	if check(i) == True:
		print('YES')
	else:
		print('NO')


l = 1000002
z = [1, 1] + [0] * l
s = set()
for i in range(1, l):
	if z[i] == 0:
		z[i * i::i] = [1] * (l // i - i + 1)
		s.add(i * i)
n = int(input())
for i in map(int, input().split()):
	r = int(i ** 0.5)
	print('YNEOS'[i not in s::2])


import math
pr = [1] * 1000010

def __init():
	(pr[0], pr[1]) = (0, 0)
	for i in range(2, int(math.sqrt(1000010)) + 1):
		if pr[i]:
			for j in range(2 * i, 1000010, i):
				pr[j] = 0

def isTPrime(n):
	root = int(math.sqrt(n))
	if root ** 2 == n:
		return pr[root]
	return 0
n = int(input())
arr = list(map(int, input().split()))
__init()
for i in range(0, n):
	stat = isTPrime(arr[i])
	if stat:
		print('YES')
	else:
		print('NO')


def bin_search(l, n, item):
	first = 0
	last = n - 1
	while first <= last:
		mid = (first + last) // 2
		if l[mid] == item:
			return True
		elif item > l[mid]:
			first = mid + 1
		else:
			last = mid - 1
	return False
MAX = 1000005
arr = [True for i in range(MAX + 1)]
p = 2
while p <= MAX:
	if arr[p]:
		for i in range(p * p, MAX, p):
			arr[i] = False
	p += 1
sqr = []
for i in range(2, MAX + 1):
	if arr[i]:
		sqr.append(i * i)
len_sqr = len(sqr)
n = int(input())
inp = list(map(int, input().split()))
for i in inp:
	if bin_search(sqr, len_sqr, i):
		print('YES')
	else:
		print('NO')


class Solution(object):

	def __init__(self):
		x_lim = 20
		self.largest_x = pow(2, x_lim)
		a = [1] * (self.largest_x + 1)
		end = self.largest_x + 1
		ans = set()
		for i in range(2, end):
			if a[i]:
				for j in range(pow(i, 2), end, i):
					a[j] = 0
				ans.add(pow(i, 2))
		input()
		for x in map(int, input().split()):
			print('YES') if x in ans else print('NO')
	pass

def main():
	Solution()
	pass
main()


def cal_primeflag():
	primeflag = [0] * 1000000
	primeflag[0] = primeflag[1] = 1
	for i in range(1000000):
		if primeflag[i] == 0:
			for j in range(i * i, 1000000, i):
				primeflag[j] = 1
	return primeflag
n = int(input())
l = input().split()
primeflag = cal_primeflag()
for i in range(n):
	l[i] = int(l[i])
	if l[i] == 4:
		print('YES')
	elif l[i] % 2 == 0:
		print('NO')
	elif pow(l[i], 0.5) == int(pow(l[i], 0.5)):
		if primeflag[int(pow(l[i], 0.5))] == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


N = 1000000
primeFlagList = [True] * N
primeFlagList[0] = False
primeFlagList[1] = False
numSet = set()
for i in range(2, N):
	if primeFlagList[i] is True:
		primeFlagList[i * 2::i] = [False] * len(primeFlagList[i * 2::i])
		numSet.add(i * i)
nStr = input()
numList = list(map(int, input().split()))
for number in numList:
	if number in numSet:
		print('YES')
	else:
		print('NO')


import math as m
n = int(input())
s = set()
l = [True] * 1000001
l[0] = l[1] = False
for i in range(2, 1000001):
	if l[i]:
		for j in range(i * i, 1000001, i):
			l[j] = False
		s.add(i * i)
for x in input().split():
	print('YES' if int(x) in s else 'NO')


import sys
N = 10 ** 6 + 1
f = sys.stdin
_ = int(f.readline())
inp = [int(i) for i in f.readline().strip().split()]
steveArr = [True] * N
_steBool = set()
for i in range(2, N):
	if steveArr[i]:
		_steBool.add(i ** 2)
		for j in range(i, N, i):
			steveArr[j] = False
for i in inp:
	if i in _steBool:
		print('YES')
	else:
		print('NO')


from bisect import bisect_left
from math import sqrt

def main():
	input()
	tt = [4]
	l = list(map(int, input().split()))
	limit = int(sqrt(max(l))) + 1000
	lim2 = limit // 2 - 1
	sieve = [True] * lim2
	for i in range(lim2 // 3 + 1):
		if sieve[i]:
			(p, pp) = (2 * i + 3, (i + 3) * i * 2 + 3)
			sieve[pp::p] = [False for _ in range(pp, lim2, p)]
	for (i, f) in enumerate(sieve):
		if f:
			i += i + 3
			tt.append(i * i)
	for x in l:
		print(('NO', 'YES')[tt[bisect_left(tt, x)] == x])
main()


import math
seive = [True for i in range(0, 1000001)]
for i in range(2, int(math.sqrt(1000001)) + 1):
	if seive[i] == True:
		for j in range(2 * i, 1000001, i):
			seive[j] = False
seive[0] = False
seive[1] = False
n = int(input())
a = list(map(int, input().rstrip().split()))
for i in a:
	p = math.sqrt(i)
	if math.ceil(p) == math.floor(p):
		if seive[math.ceil(p)] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
s = [int(y) for y in input().split()]
N = int(max(s) ** 0.5) + 1
p = [True] * N
t = 2
while t * 2 <= N:
	if p[t] == True:
		for i in range(t * 2, N, t):
			p[i] = False
	t += 1
p[1] = False
for j in range(n):
	x = s[j] ** 0.5
	if x != int(x):
		print('NO')
	elif p[int(x)] == True:
		print('YES')
	else:
		print('NO')


n = 10 ** 6 + 1
array = [1] * n
tprimes = {4}
for i in range(2, n):
	if array[i]:
		for j in range(i * i, n, i):
			array[j] = 0
		tprimes.add(i * i)
input()
for ni in map(int, input().split()):
	print(['NO', 'YES'][ni in tprimes])


import math
from math import sqrt
primes = [True] * 1000001

def sieve():
	for i in range(2, int(sqrt(1000001)) + 1):
		if primes[i] == True:
			for j in range(2 * i, 1000001, i):
				primes[j] = False

def solve(arr, n):
	for i in range(n):
		x = int(sqrt(arr[i]))
		if x * x == arr[i] and primes[int(x)] == True:
			print('YES')
		else:
			print('NO')
n = int(input())
primes[1] = False
sieve()
arr = [int(x) for x in input().split()]
solve(arr, n)


from math import sqrt

def e(n, pr):
	p = 2
	while p * p <= n:
		if pr[p] == True:
			for i in range(2 * p, n + 1, p):
				pr[i] = False
		p += 1
n = int(input())
pr = [True] * (10 ** 6 + 1)
e(10 ** 6, pr)
x = [int(x) for x in input().split()]
for i in x:
	if i < 4:
		print('NO')
		continue
	elif int(sqrt(i)) ** 2 != i:
		print('NO')
		continue
	if pr[int(sqrt(i))]:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans
from math import *
for _ in range(1):
	sieve = sieve_of_eratosthenes(1000009)
	ll = len(sieve)
	n = int(input())
	nums = list(map(int, input().split()))
	for i in nums:
		if i % sqrt(i) == 0:
			if binary_search(sieve, sqrt(i), 0, ll - 1) == 1:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


import math

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
n = int(input())
a = list(map(int, input().split()))
for i in a:
	r = math.sqrt(i)
	if r - math.floor(r) == 0:
		f = isPrime(int(r))
		if f == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt
(n, arr) = (int(input()), list(map(int, input().split(' '))))
M = int(sqrt(max(arr))) + 1

def Euler(upper):
	filters = [False] * (upper + 2)
	prime = []
	for num in range(2, upper + 1):
		if not filters[num]:
			prime.append(num)
		for each in prime:
			if num * each > upper:
				break
			filters[num * each] = True
			if num % each == 0:
				break
	return (prime, filters)

def binary_search(aim, l):
	ele = len(l)
	mid = ele // 2
	if ele > 0:
		if l[mid] == aim:
			return True
		elif l[mid] > aim:
			return binary_search(aim, l[:mid])
		else:
			return binary_search(aim, l[mid + 1:])
	else:
		return False
(p_list, table_all) = Euler(M)
for i in range(n):
	if arr[i] in [1, 2, 3]:
		print('NO')
	elif int(sqrt(arr[i])) ** 2 == arr[i] and (not table_all[int(sqrt(arr[i]))]):
		print('YES')
	else:
		print('NO')


primes = [True] * (10 ** 6 + 1)

def create_prime_list():
	for i in range(2, len(primes)):
		if primes[i]:
			for j in range(i * i, len(primes), i):
				primes[j] = False
create_prime_list()
import math
number = int(input())
numbers = [int(i) for i in input().split()]
ans = ''
for i in range(number):
	if numbers[i] < 4:
		ans += 'NO\n'
		continue
	if math.sqrt(numbers[i]) == int(math.sqrt(numbers[i])) and primes[int(math.sqrt(numbers[i]))]:
		ans += 'YES\n'
	else:
		ans += 'NO\n'
print(ans)


import math
n = int(input())
Max = 1000005
val = list(map(str, input().split()))
prime = [1] * Max
prime[0] = 0
prime[1] = 0
for i in range(2, int(math.sqrt(Max))):
	if prime[i] == 1:
		for j in range(i * 2, Max, i):
			prime[j] = 0
for i in range(n):
	num = int(math.sqrt(int(val[i])))
	if num * num == int(val[i]) and prime[num] == 1:
		print('YES')
	else:
		print('NO')


primes = [1] * 1000001
primes[0] = primes[1] = 0
for i in range(2, int(1000001 ** 0.5)):
	if primes[i]:
		for j in range(i ** 2, 1000001, i):
			primes[j] = 0
import math
n = int(input())
x = list(map(int, input().split()))
for item in x:
	root = math.sqrt(item)
	if item == 1:
		print('NO')
	elif item == 4:
		print('YES')
	elif item % 2 == 0:
		print('NO')
	elif int(root + 0.5) ** 2 == item and primes[int(root)]:
		print('YES')
	else:
		print('NO')


import math

def isPrime(a):
	if a == 1:
		return False
	d = 2
	while d * d <= a:
		if a % d == 0:
			return False
		d += 1
	return True
n = int(input())
a = [int(x) for x in input().split()]
for e in a:
	d = math.floor(math.sqrt(e))
	if d * d == e and isPrime(d):
		print('YES')
	else:
		print('NO')


from math import *
N = 1000000
l = [True for i in range(N + 1)]
l[0] = False
l[1] = False
i = 2
while i * i <= N:
	if l[i] == True:
		j = i * i
		while j <= N:
			l[j] = False
			j += i
	i += 1
n = int(input())
arr = [int(x) for x in input().split()]
for i in arr:
	a = i ** 0.5
	b = floor(a)
	if a == b and l[b] == True:
		print('YES')
	else:
		print('NO')


n = 6
s = set()
l = [False] * 2 + [True] * (10 ** n - 1)
for i in range(2, 10 ** n + 1):
	if l[i] == True:
		s.add(i * i)
		for j in range(2 * i, 1 + 10 ** n, i):
			l[j] = False
p = int(input())
q = map(int, input().split())
for x in q:
	if x in s:
		print('YES')
	else:
		print('NO')


a = 1000001
t = [1] * a
p = 2
while p ** 2 <= a:
	if t[p] == 1:
		for j in range(p * 2, a, p):
			t[j] = 0
	p += 1
t[0] = 0
t[1] = 0
import math
n = int(input())
h = list(map(int, input().split()))
for j in range(n):
	x = math.sqrt(h[j])
	if int(x) == x:
		if t[int(x)] == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = 1000000
arr = [1] * n
seto = set()
for a in range(2, n):
	if arr[a]:
		seto.add(a * a)
		for i in range(a * a, n, a):
			arr[i] = 0
a = int(input())
for x in map(int, input().split()):
	print('YES' if x in seto else 'NO')


from sys import stdin
from math import sqrt
limit = 1000000
lista = [True for i in range(limit + 1)]
p = 2
while p * p <= limit:
	if lista[p]:
		for i in range(2 * p, limit + 1, p):
			lista[i] = False
	p += 1
lista[0] = False
lista[1] = False
n = stdin.readline()
nums = stdin.readline().split()
for num in nums:
	num = int(num)
	root = sqrt(num)
	if root - int(root) == 0 and lista[int(root)]:
		print('YES')
	else:
		print('NO')


def pr(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	t1 = l[i] ** 0.5
	if l[i] == 1:
		print('NO')
	elif t1 == int(t1):
		if pr(int(t1)):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
x = list(map(int, input().split()))
for i in x:
	if i == 1:
		print('NO')
	elif int(math.sqrt(i)) != math.sqrt(i):
		print('NO')
	else:
		c = 0
		k = int(math.sqrt(i))
		for j in range(2, int(math.sqrt(k)) + 1):
			if k % j == 0:
				c += 1
		if c == 0:
			print('YES')
		else:
			print('NO')


n = int(input())
l = [int(x) for x in input().split()]
p = [1] * 1000005
p[1] = 0
p[0] = 0
for i in range(2, 1000):
	if p[i] == 1:
		k = i * i
		while k < 1000001:
			p[k] = 0
			k = k + i
for i in range(n):
	m = int(l[i] ** 0.5)
	if m * m == l[i] and p[m] == 1:
		print('YES')
	else:
		print('NO')


from math import *
p = list()
MAX = 10 ** 6
for i in range(MAX + 1):
	if i % 2 == 0:
		p.append(0)
	else:
		p.append(1)
p[0] = 0
p[1] = 0
p[2] = 1
for i in range(3, MAX + 1, 2):
	if p[i] == 1:
		for j in range(i * i, MAX + 1, i):
			p[j] = 0
n = int(input())
l = list(map(int, input().split()))
for i in l:
	q = int(sqrt(i))
	if floor(sqrt(i)) == ceil(sqrt(i)) and p[q] == 1 and (i > 2):
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
prime = []

def sieveEras(n):
	global prime
	m = n + 1
	numbers = [True] * m
	for i in range(2, int(n ** 0.5 + 1)):
		if numbers[i]:
			for j in range(i * i, m, i):
				numbers[j] = False
	for i in range(2, m):
		if numbers[i]:
			prime.append(i)
sieveEras(1000001)
tprime = set()
for i in prime:
	tprime.add(i ** 2)
n = ii1()
arr = iia()
for i in arr:
	if i in tprime:
		print('YES')
	else:
		print('NO')


def TPrimes(n, arr):
	l = [1] * 1000001
	l[0] = 0
	l[1] = 0
	limit = int(1000001 ** (1 / 2))
	for i in range(2, limit):
		if l[i] == 1:
			k = i
			while k + i <= 1000000:
				k += i
				l[k] = 0
	for i in arr:
		ok = int(i) ** (1 / 2)
		if ok == int(ok):
			if l[int(ok)] == 1:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
n = int(input())
arr = list(map(int, input().split()))
TPrimes(n, arr)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def in_int():
	return int(input())

def in_list():
	return list(map(int, input().split()))

def in_str():
	s = input()
	return list(s[:len(s) - 1])

def in_ints():
	return map(int, input().split())
mod = 7 + 10 ** 9
import math
prime = [True] * (1 + 10 ** 6)
prime[0] = prime[1] = False
for i in range(2, 1 + 10 ** 6):
	if prime[i]:
		for j in range(2 * i, 1 + 10 ** 6, i):
			prime[j] = False
n = in_int()
a = in_list()
for xx in a:
	x = int(math.sqrt(xx))
	if xx == x * x and prime[x]:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	x = int(math.sqrt(a[i]))
	if x ** 2 != a[i] or x == 1:
		print('NO')
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				print('NO')
				break
		else:
			print('YES')


from math import sqrt, ceil
n = int(input())
l = [int(x) for x in input().split()]

def calcula_primos(n):
	primos = [0] * (n + 1)
	for i in range(2, ceil(sqrt(n)) + 1):
		if primos[i] == 0:
			step = 2 * i
			while step <= n:
				primos[step] = 1
				step = step + i
	return primos
resp = set()
primos = calcula_primos(1000000)
for i in range(len(primos)):
	if primos[i] == 0:
		resp.add(i ** 2)
for i in l:
	if i == 1:
		print('NO')
		continue
	if i in resp:
		print('YES')
	else:
		print('NO')


def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
t = int(input())
l = input().split()
for i in range(t):
	n = int(l[i])
	r = int(n ** (1 / 2))
	if r * r != n:
		print('NO')
	elif isPrime(r):
		print('YES')
	else:
		print('NO')


def sieve(x):
	isprime = [True for y in range(x)]
	isprime[0] = False
	isprime[1] = False
	for i in range(2, int(x ** 0.5) + 1):
		for j in range(i * i, x, i):
			isprime[j] = False
	return isprime
primecheck = sieve(1000001)
lenght = int(input())
numbers = list(map(int, input().split()))
for i in numbers:
	if float(i ** 0.5) == int(i ** 0.5):
		if primecheck[int(i ** 0.5)]:
			print('YES')
			continue
		else:
			print('NO')
			continue
	else:
		print('NO')
		continue


n = int(input())
temp = input().split()
x = []
for i in range(n):
	x.append(int(temp[i]))
limit = 1000001
prime_flag = [True] * limit
prime_flag[0] = prime_flag[1] = False
for i in range(2, limit):
	if prime_flag[i] == True:
		for j in range(i * i, limit, i):
			prime_flag[j] = False
for i in x:
	t_prime = 0
	if int(i ** 0.5) == i ** 0.5 and prime_flag[int(i ** 0.5)] == True:
		t_prime = 1
	if t_prime == 1:
		print('YES')
	else:
		print('NO')


import math
lst = [1] * 1000001
cnt = 2
while cnt ** 2 <= 1000000:
	if lst[cnt]:
		for i in range(cnt ** 2, 1000001, cnt):
			lst[i] = 0
	cnt += 1
n = int(input())
a = list(map(int, input().split()))
for i in a:
	if i == 1:
		print('NO')
	elif math.ceil(i ** 0.5) == int(i ** 0.5):
		if lst[int(i ** 0.5)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math

def solve(x):
	n = int(math.sqrt(x))
	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False
	return True
n = int(input())
arr = list(map(int, input().split()))
for i in arr:
	if i != 1 and int(math.sqrt(i)) ** 2 == i and (solve(i) == True):
		print('YES')
	else:
		print('NO')


from math import sqrt

def perfectSquare(n):
	root = sqrt(n)
	if int(root + 0.5) ** 2 == n:
		return (True, int(root + 0.5))
	else:
		return (False, -1)

def primes(n):
	prime = [True] * (n + 1)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def TPrime(n):
	if n == 4:
		return True
	if n < 9:
		return False
	if n % 2 == 0:
		return False
	(ps, root) = perfectSquare(n)
	if not ps:
		return False
	if prime[root] == False:
		return False
	return True

def main():
	t = int(input())
	tests = map(int, input().split())
	for t in tests:
		if TPrime(t):
			print('YES')
		else:
			print('NO')
prime = primes(10 ** 6)
main()


from math import sqrt
prime = [*range(1000001)]
p = 2
while p * p < 1000001:
	if prime[p] != -1:
		for i in range(p + p, 1000001, p):
			prime[i] = -1
	p += 1
lol = []
for i in range(2, 1000001):
	if prime[i] != -1:
		lol.append(i)

def search(n):
	low = 1
	high = len(lol)
	f = 0
	while low <= high and f == 0:
		mid = (low + high) // 2
		d = lol[mid - 1]
		if d == n:
			f = 1
			break
		elif d > n:
			high = mid - 1
		else:
			low = mid + 1
	return f
x = int(input())
a = list(map(int, input().split()))
for i in range(x):
	q = sqrt(a[i])
	if q == int(q):
		q = int(q)
		k = search(q)
		if k == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(1000000.0) + 1
q = [True] * n
ans = set()
for i in range(2, n):
	if q[i]:
		for j in range(i * i, n, i):
			q[j] = False
		ans.add(i * i)
input()
for d in map(int, input().split()):
	if d in ans:
		print('YES')
	else:
		print('NO')


def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
			r.add(i * i)
	return a
n = 2 ** 20
r = set()
sieve(n)
input()
for a in I():
	print(['NO', 'YES'][a in r])


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
from itertools import permutations
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def valid(row, col, rows, cols, rcross, lcross):
	return rows[row] == 0 and cols[col] == 0 and (rcross[col + row] == 0) and (lcross[col - row] == 0)

def div(n):
	if n == 1:
		return 1
	cnt = 2
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			if i != n // i:
				cnt += 2
			else:
				cnt += 1
	return cnt

def isPrime(n):
	if n <= 1:
		return False
	elif n <= 2:
		return True
	else:
		flag = True
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				flag = False
				break
		return flag

def s(b):
	ans = []
	while b > 0:
		tmp = b % 10
		ans.append(tmp)
		b = b // 10
	return ans
prime = [1] * (10 ** 6 + 1)
prime[1] = 0
for i in range(2, int(10 ** 6 + 1)):
	if prime[i] == 1:
		for j in range(i * i, 10 ** 6 + 1, i):
			prime[j] = 0

def main():
	n = ii()
	arr = li()
	ans = ''
	for i in arr:
		x = int(math.sqrt(i))
		if x ** 2 == i:
			if prime[x]:
				ans += 'YES\n'
			else:
				ans += 'NO\n'
		else:
			ans += 'NO\n'
	print(ans)
main()


n = int(input())
x = [int(q) for q in input().split()]
j = 2 ** 20
primes = {4}
prime = [True for i in range(j + 1)]
prime[0] = False
prime[1] = False
p = 2
for i in range(2, j + 1):
	if prime[p] == True:
		primes.add(p * p)
		for i in range(p * p, j + 1, p):
			prime[i] = False
	p += 1
for i in range(len(x)):
	if x[i] in primes:
		print('YES')
	else:
		print('NO')


import math

def isPerfectSquare(x):
	sr = math.sqrt(x)
	if sr - math.floor(sr) == 0:
		return sr
n1 = int(input())
l1 = list(map(int, input().split()))
n = 1000000
l = [False, False]
prime = [True for i in range(n + 1)]
p = 2
while p * p <= n:
	if prime[p] == True:
		for i in range(p * p, n + 1, p):
			prime[i] = False
	p += 1
for i in range(n1):
	if l1[i] == 1 or l1[i] == 2 or l1[i] == 3:
		print('NO')
	elif isPerfectSquare(l1[i]):
		k = int(isPerfectSquare(l1[i]))
		if prime[k] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import atexit
import io
import sys
import bisect
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())

def main():
	n = int(10 ** 6)
	t = list(range(3, n + 1, 2))
	(isPrime, i, v) = ([2], 0, 3)
	ls = len(t)
	while v < n:
		if t[i]:
			isPrime.append(t[i])
			j = i + v
			while j < ls:
				t[j] = 0
				j += v
		i += 1
		v = 2 * i + 3
	input()
	for i in map(int, input().split()):
		root = i ** 0.5
		idx = bisect.bisect_right(isPrime, root)
		if idx != 0 and isPrime[idx - 1] == root or (idx == 0 and isPrime[idx] == root):
			print('YES')
		else:
			print('NO')
main()


import math

def gerarp():
	MAX = 10 ** 6 + 1
	primos = [True] * MAX
	primos[0] = False
	primos[1] = False
	for i in range(2, MAX, 1):
		if primos[i]:
			for j in range(i * 2, MAX, i):
				primos[j] = False
	return primos
primos = gerarp()
p = input()
lista = list(map(int, input().split()))
resultados = []
for i in lista:
	raiz = int(math.sqrt(i))
	if raiz ** 2 == i and primos[raiz]:
		resultados.append('YES')
	else:
		resultados.append('NO')
print('\n'.join(resultados))


N = int(input())
st = [0] * 2 + [1] * 1000001
for i in range(2, 1001):
	if st[i]:
		st[2 * i::i] = [0] * ((1000001 - 2 * i + 1) // i + 1)
for i in map(int, input().split()):
	print(['NO', 'YES'][int(i ** 0.5) == i ** 0.5 and st[int(i ** 0.5)]])


from math import sqrt
n = int(input())

def isPrime(a):
	if a < 2:
		return False
	for i in range(2, int(sqrt(a)) + 1):
		if a % i == 0:
			return False
	return True
t = [int(x) for x in input().split()]
for i in range(n):
	k = sqrt(t[i])
	if k == int(k):
		answer = isPrime(int(k))
		if answer == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd, log10, atan, tan

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_strs():
	return map(str, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res
primes = set(prime_list(1000010))
n = int(input())
Arr = get_array()
for i in range(n):
	number = sqrt(Arr[i])
	if floor(number) == ceil(number) and floor(number) in primes:
		print('YES')
	else:
		print('NO')


import math

def sieve(size):
	res = [1] * size
	sie = [-1] * size
	for i in range(2, int(size ** 0.5) + 1):
		if sie[i] != -1:
			continue
		for j in range(i * i, size, i):
			sie[j] = i
			res[j] += 1
	return sie
s = sieve(10 ** 6 + 1)
input()
a = list(map(int, input().split()))
for i in a:
	t = math.sqrt(i)
	if i > 1 and t.is_integer() and (s[int(t)] == -1):
		print('YES')
	else:
		print('NO')


n = int(1000000.0 + 2)
q = [1] * n
tprimes = set()
for i in range(2, n):
	if q[i]:
		for j in range(2 * i, n, i):
			q[j] = 0
		tprimes.add(i * i)
input()
s = [int(x) for x in input().split()]
for x in s:
	print('YES' if x in tprimes else 'NO')


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))[::-1]
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
primes = set()

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			primes.add(p)
SieveOfEratosthenes(10 ** 6)
perfSq = set()
for el in primes:
	perfSq.add(el * el)
n = INT()
l = LIST()
for el in l:
	if el in perfSq:
		print('YES')
	else:
		print('NO')


from math import sqrt
n = int(input())
z = [int(j) for j in input().split()]
g = 10 ** 6 + 1
l = [1] * g
l[0] = 0
l[1] = 0
for i in range(2, g):
	if l[i] == 1:
		for j in range(i + i, g, i):
			l[j] = 0
for i in z:
	t = sqrt(i)
	flag = 0
	if t % 1 == 0:
		t = int(t)
		if l[t] == 1:
			flag = 1
	if flag:
		print('YES')
	else:
		print('NO')


import math

def sqr_sieve():
	n = 10 ** 6
	i = 2
	d = dict.fromkeys([i for i in range(1, n + 1)], 0)
	d[1] = 1
	while i * i <= n:
		if d[i] == 0:
			j = i * i
			while j <= n:
				d[j] = 1
				j += i
		i += 1
	return d
n = int(input())
xs = list(map(int, input().split()))
d = sqr_sieve()
for x in xs:
	try:
		print('NO') if d[math.sqrt(x)] else print('YES')
	except KeyError:
		print('NO')


input()
l = 1000002
c = [1, 1] + [0] * l
for i in range(2, l // 2 + 1):
	if not c[i]:
		for j in range(i * i, l, i):
			c[j] = 1
for i in input().split():
	i = int(i)
	print('YES' if not c[int(i ** 0.5)] and int(i ** (1 / 2)) ** 2 == i else 'NO')


def genListPrimes(n):
	listPrimes = [True] * n
	listPrimes[0] = listPrimes[1] = False
	for i in range(2, n):
		if listPrimes[i] == True:
			for j in range(i * i, n, i):
				listPrimes[j] = False
	return listPrimes

def calc(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if listPrimes[int(sqrt_n)]:
			return True
	return False
listPrimes = genListPrimes(10 ** 6 + 50)
qtd = int(input())
input_array = [int(x) for x in input().split()]
for i in input_array:
	if calc(i) == True:
		print('YES')
	else:
		print('NO')


input()
n = 1000002
a = [1, 1] + [0] * n
for i in range(2, n):
	if 1 - a[i]:
		for j in range(i * i, n, i):
			a[j] = 1
for i in input().split():
	i = int(i)
	b = int(i ** 0.5)
	print('YNEOS'[a[b] or b * b != i::2])


import math
numbers = [True] * (10 ** 6 + 1)
numbers[0] = numbers[1] = False
for i in range(2, int(math.sqrt(len(numbers)))):
	if numbers[i]:
		for j in range(i ** 2, len(numbers), i):
			numbers[j] = False
square_numbers = frozenset([i ** 2 for i in range(len(numbers)) if numbers[i]])
n = int(input())
x = list(map(int, input().split()))
for i in x:
	if i in square_numbers:
		print('YES')
	else:
		print('NO')


def solve(n):
	n = int(n ** 0.5)
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True
n = int(input())
arr = list(map(int, input().split()))
for i in arr:
	if int(i ** 0.5) ** 2 == i and solve(i) and (i != 1):
		print('YES')
	else:
		print('NO')


n = int(input())
s = list(map(int, input().split()))
maior = int(max(s) ** (1 / 2))
primos = [True for i in range(maior + 1)]
p = 2
while p ** 2 <= maior:
	if primos[p]:
		for i in range(p ** 2, maior + 1, p):
			primos[i] = False
	p += 1
for f in s:
	raiz = f ** (1 / 2)
	if raiz == int(raiz):
		if raiz == 1:
			print('NO')
		elif primos[int(raiz)]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
List = [1] * 1000005
List[0] = List[1] = 0
for x in range(2, 1000001):
	if List[x]:
		for j in range(x * 2, 1000001, x):
			List[j] = 0
n = int(input())
L = list(map(int, input().split()))
for i in L:
	a = math.sqrt(i)
	if a == int(a) and List[int(a)]:
		print('YES')
	else:
		print('NO')


def sieve_of_eratosthenes(n):
	prime = [True for i in range(n + 1)]
	prime[0] = False
	prime[1] = False
	x = 2
	while x ** 2 <= n:
		if prime[x] == True:
			for i in range(x ** 2, n + 1, x):
				prime[i] = False
		x += 1
	return prime
database = sieve_of_eratosthenes(1000001)
n = int(input())
s = list(str(input()).split())
s = [int(i) for i in s]
for i in range(n):
	a = s[i] ** 0.5
	if a != int(a):
		print('NO')
	elif database[int(a)] == True:
		print('YES')
	else:
		print('NO')


n = int(input())
nums = [int(i) for i in input().split()]

def prime_list(n):
	prime_bool = [True for i in range(n + 1)]
	(prime_bool[0], prime_bool[1]) = (False, False)
	i = 2
	while i ** 2 <= n:
		if prime_bool[i]:
			for j in range(2 * i, n, i):
				prime_bool[j] = False
		i += 1
	return prime_bool
prime_bool_list = prime_list(10 ** 6 + 1)
for num in nums:
	if num ** 0.5 == int(num ** 0.5) and prime_bool_list[int(num ** 0.5)]:
		print('YES')
	else:
		print('NO')


from math import sqrt
limit = 1000000
isPrime = [True for i in range(limit + 1)]
isPrime[1] = False
p = 2
while p * p <= limit:
	if isPrime[p]:
		for i in range(2 * p, limit + 1, p):
			isPrime[i] = False
	p += 1

def isTprime(n):
	x = int(sqrt(n))
	if x * x == n:
		return isPrime[x]
	else:
		return False
n = int(input())
a = list(map(int, input().split()))
for i in a:
	if isTprime(i):
		res = 'YES'
	else:
		res = 'NO'
	print(res)


import time

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	return prime
prime = SieveOfEratosthenes(1000001)
n = int(input())
A = [int(i) for i in input().split()]
for i in range(0, n):
	val = int(A[i] ** 0.5)
	if val ** 2 == A[i]:
		if prime[val]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
input()

def is_square(n):
	return int(math.sqrt(n)) * int(math.sqrt(n)) == int(n)

def is_prime(n):
	for i in range(2, n):
		if i * i > n:
			break
		if n % i == 0:
			return False
	return True
for cur in map(int, input().split()):
	print('YES' if is_square(cur) and is_prime(int(math.sqrt(cur))) and (not cur == 1) else 'NO')


def is_prime(a):
	counter = 0
	for i in range(1, int(a ** 0.5) + 1):
		if a % i == 0:
			counter += 1
	return True if counter == 1 else False
n = int(input())
my_list = list(map(int, input().split()))
list_of_answers = []
for number in my_list:
	if number % 2 == 0 and number != 4 or number == 1:
		list_of_answers.append('NO')
	elif (number ** 0.5).is_integer() and is_prime(int(number ** 0.5)):
		list_of_answers.append('YES')
	else:
		list_of_answers.append('NO')
for a in list_of_answers:
	print(a)


import sys
t_prime = set()
is_prime = [True for i in range(10 ** 6 + 1)]
is_prime[0] = is_prime[1] = False
for p in range(2, 10 ** 6 + 1):
	if is_prime[p]:
		t_prime.add(p ** 2)
		for k in range(2 * p, 10 ** 6 + 1, p):
			is_prime[k] = False
N = int(sys.stdin.readline())
array = [int(x) for x in sys.stdin.readline().split()]
for i in array:
	if i in t_prime:
		print('YES')
	else:
		print('NO')


def prime(n):
	arr = [True] * (n + 1)
	arr[0] = arr[1] = False
	for i in range(2, int((n + 1) ** 0.5)):
		if arr[i] == True:
			for j in range(2 * i, n + 1, i):
				arr[j] = False
	return arr
n = int(input())
arr = [int(x) for x in input().strip().split()]
prime = prime(10 ** 6)

def is_int(n):
	k = float(int(n))
	if k != n:
		return False
	return True
for i in arr:
	x = i ** 0.5
	if is_int(x) and prime[int(x)]:
		print('YES')
	else:
		print('NO')


import math

def isPrime(n):
	if n <= 1:
		return False
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	else:
		return True
n = input()
ls = list(map(int, input().split()))
for i in ls:
	x = math.sqrt(i)
	if x.is_integer():
		if isPrime(int(x)):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = 10 ** 6
a = [1] * n
r = {4}
for i in range(2, n):
	if a[i]:
		r.add(i ** 2)
		for j in range(i ** 2, n, i):
			a[j] = 0
input()
numbers = list(map(int, input().split()))
for d in numbers:
	print(['NO', 'YES'][d in r])


MAXP = 10 ** 6 + 1
MAXD = int(MAXP ** 0.5) + 1
primes = [True] * MAXP
primes[0] = primes[1] = False
for i in range(2, MAXD):
	if primes[i]:
		for j in range(i * i, MAXP, i):
			primes[j] = False
n = int(input())
arr = list(map(int, input().split()))
ans = []
for i in arr:
	if i ** 0.5 % 1 != 0:
		ans.append('NO')
		continue
	if primes[int(i ** 0.5)]:
		ans.append('YES')
	else:
		ans.append('NO')
print('\n'.join(ans))


n = int(input())
arr = [int(i) for i in input().split()]
MAXN = 10 ** 6
prime = [True for i in range(MAXN + 1)]
prime[0] = False
prime[1] = False
from math import sqrt
for i in range(2, int(sqrt(MAXN)) + 1):
	if prime[i]:
		num = i * i
		while num <= MAXN:
			prime[num] = False
			num += i
for i in arr:
	if int(sqrt(i)) == sqrt(i) and prime[int(sqrt(i))]:
		print('YES')
	else:
		print('NO')


import math
n = int(input())

def prime(x):
	if x < 2:
		return False
	for i in range(2, int(math.sqrt(x)) + 1):
		if x % i == 0:
			return False
	return True
s = [int(x) for x in input().split()]
for i in range(n):
	m = math.sqrt(s[i])
	if m == int(m):
		if prime(int(m)) == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


N = int(1000000.0 + 3)
q = [1] * N
tprimes = set()
for i in range(2, N):
	if q[i]:
		for j in range(2 * i, N, i):
			q[j] = 0
		tprimes.add(i * i)
input()
for x in map(int, input().split()):
	print('YES' if x in tprimes else 'NO')


import math
from bisect import bisect_left, bisect, bisect_right

def index(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return 1
	return 0

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	l1 = []
	for i in range(n + 1):
		if prime[i] == True:
			l1.append(i)
	return l1
primes = SieveOfEratosthenes(1000000)
n = int(input())
l = list(map(int, input().split()))
for i in l:
	p = math.sqrt(i)
	if p % 1 != 0:
		print('NO')
		continue
	if index(primes, p):
		print('YES')
	else:
		print('NO')


x = int(input())
lista = list(map(int, input().split()))
long = 1000000000000 ** 0.5
long = int(long) + 1
isPrime = [False] * 2 + [True] * long
for i in range(2, long):
	if isPrime[i]:
		for j in range(i ** 2, long, i):
			isPrime[j] = False
for i in lista:
	sqrt = int(i ** 0.5)
	if isPrime[sqrt] and sqrt ** 2 == i:
		print('YES')
	else:
		print('NO')


import sys
from math import sqrt
mod = 1000000007
n = 1000000

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def print_array(a):
	print(' '.join(map(str, a)))
prime = [True] * (n + 1)
prime[1] = prime[0] = False
p = 2
while p * p <= n:
	if prime[p] == True:
		for i in range(p * p, n + 1, p):
			prime[i] = False
	p += 1

def main():
	n = int(input())
	p = get_array()
	for x in p:
		s = sqrt(x)
		print('YES' if s == int(s) and prime[int(s)] else 'NO')
main()


range_L = 1000000

def cal():
	prime_flag = [True] * range_L
	prime_flag[0] = prime_flag[1] = False
	for i in range(2, range_L):
		if prime_flag[i] == True:
			for j in range(i * i, range_L, i):
				prime_flag[j] = False
	return prime_flag

def check(n):
	if n == 4:
		return True
	if n < 4 or n % 2 == 0:
		return False
	sqrt_n = n ** 0.5
	if sqrt_n == int(sqrt_n):
		if prime_flag[int(sqrt_n)] == True:
			return True
	return False
prime_flag = cal()
total_numbers = int(input())
input_array = list(map(int, input().split()))
for i in input_array:
	if check(i) == True:
		print('YES')
	else:
		print('NO')


import math
maxsize = 1000001
candidates = [True] * maxsize
sqrts = [0] * maxsize
for i in range(2, maxsize):
	if candidates[i]:
		sqrts[i] = 1
		for j in range(i ** 2, maxsize, i):
			candidates[j] = False
n = int(input())
xs = input().split(' ')
for i in xs:
	i = int(i)
	sqrt = math.sqrt(i)
	if sqrt == int(sqrt) and sqrts[int(sqrt)] == 1:
		print('YES')
	else:
		print('NO')


sv = [True for i in range(1000001)]
for i in range(2, len(sv)):
	if sv[i]:
		for j in range(2 * i, len(sv), i):
			sv[j] = False
sv[1] = False
input()
arr = [int(x) for x in input().split()]
for l in arr:
	x = int(l ** 0.5)
	if x ** 2 == l:
		if sv[x]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
n = int(input())
l = [int(i) for i in input().split()]
for i in range(0, n):
	s = math.sqrt(l[i])
	s = int(s)
	if l[i] == s ** 2 and s > 1:
		if s < 4:
			print('YES')
		else:
			m = int(math.sqrt(s))
			c = 1
			for j in range(1, m + 1):
				if s % j == 0:
					c += 1
			if c == 2:
				print('YES')
			else:
				print('NO')
	else:
		print('NO')


import math
m = 10 ** 6 + 3
flag = [0] * m
flag[1] = 1
for i in range(2, 1001):
	if flag[i] == 0:
		prime = i * 2
		while prime <= m - 1:
			flag[prime] = 1
			prime += i
p = int(input())
s = input().split(' ')
for i in range(p):
	test = int(s[i])
	q1 = math.sqrt(test)
	if q1 == int(q1):
		q2 = int(q1)
		if flag[q2] == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


m = 1000000
l = [True] * m
s = set()
for i in range(2, m):
	if l[i]:
		s.add(i * i)
		for j in range(i, m, i):
			l[j] = False
n = int(input())
for p in map(int, input().split()):
	if p in s:
		print('YES')
	else:
		print('NO')


import math
limit = 1000000
is_prime = [True] * (limit + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, math.floor(math.sqrt(limit)) + 1):
	if is_prime[i]:
		for j in range(i * i, limit + 1, i):
			is_prime[j] = False
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	s = a[i]
	r = math.floor(math.sqrt(s))
	if r * r != s:
		print('NO')
		continue
	if is_prime[r]:
		print('YES')
	else:
		print('NO')


from math import sqrt

def primes(n):
	sieve = set(range(2, n + 1))
	for i in range(2, int(sqrt(n)) + 1):
		if i in sieve:
			sieve -= set(range(2 * i, n + 1, i))
	return sieve
n = input()
a = [int(sqrt(el)) if int(sqrt(el)) ** 2 == el else 1 for el in map(int, input().split())]
primes_a = primes(max(a))
for el in a:
	print('YES' if el in primes_a else 'NO')


from math import sqrt
N = 10 ** 6 + 5
sqr = sqrt(N)
is_prime = [True] * (10 ** 6 + 5)
is_prime[0] = is_prime[1] = False
cur = 2
while cur <= sqr:
	for i in range(cur * 2, N, cur):
		is_prime[i] = False
	for i in range(cur + 1, N):
		if is_prime[i] == True:
			cur = i
			break
n = int(input())
list1 = list(map(int, input().split()))
for i in range(n):
	this_num = list1[i]
	this_sqr = sqrt(this_num)
	if int(this_sqr) == this_sqr and is_prime[int(this_sqr)]:
		print('YES')
	else:
		print('NO')


n = int(input())
array = [int(x) for x in input().split(' ')]
limit = 2 ** 20
sieve = [1] * limit
t_primes = {4}
for i in range(2, limit):
	if sieve[i]:
		for j in range(i * i, limit, i):
			sieve[j] = 0
		t_primes.add(i * i)
for i in range(n):
	print('YES' if array[i] in t_primes else 'NO')


input()
ds = [1, 1] + [0] * 1000003
for i in range(2, 1000001):
	if ds[i] == 0:
		for j in range(i * i, 1000001, i):
			ds[j] = 1
for i in input().split():
	i = int(i)
	r = int(i ** 0.5)
	if ds[r] == 0 and r * r == i:
		print('YES')
	else:
		print('NO')


import math

def sie(x):
	s = [True] * x
	s[0] = False
	for i in range(2, x + 1):
		if s[i - 1]:
			for j in range(i * i, x + 1, i):
				s[j - 1] = False
	return s
n = int(input())
l = [int(x) for x in input().split()]
s = sie(int(math.sqrt(max(l))))
for i in l:
	if int(math.sqrt(i)) == math.sqrt(i):
		if s[int(math.sqrt(i)) - 1]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
from sys import stdin, stdout
n = int(stdin.readline())
l = list(map(int, stdin.readline().split()))
m = max(l)
N = int(math.sqrt(m)) + 2
primes = [1] * N
primes[1] = 0
p = 2
while p * p <= N:
	if primes[p]:
		for mul in range(p * p, N, p):
			primes[mul] = 0
	p += 1
for v in l:
	sq = int(math.sqrt(v))
	if sq * sq == v:
		if primes[sq]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from sys import stdin
import math
isPrime = [True] * 1000002
isPrime[0] = False
isPrime[1] = False
t_primes = set()
for x in range(2, 1000002):
	if isPrime[x]:
		t_primes.add(x * x)
		for y in range(2 * x, 1000002, x):
			isPrime[y] = False
input()
for x in map(int, input().split()):
	print('YES' if x in t_primes else 'NO')


class Eratostenes:

	def __init__(self, until):
		self.Primes = []
		Is_prime = [True for i in range(until + 10)]
		for i in range(2, until):
			if Is_prime[i]:
				self.Primes.append(i)
				for e in range(2 * i, until, i):
					Is_prime[e] = False

def busqueda_binaria(x, array):
	(Izq, Der) = (0, len(array) - 1)
	while Izq <= Der:
		middle = (Izq + Der) // 2
		if array[middle] == x:
			return middle
		elif x > array[middle]:
			Izq = middle + 1
		else:
			Der = middle - 1
	return -1
primes = Eratostenes(1000000)
primes_array = [prime * prime for prime in primes.Primes]
size = int(input())
queries = [int(i) for i in input().split()]
for i in range(size):
	index = busqueda_binaria(queries[i], primes_array)
	print('YES' if index != -1 else 'NO')


from math import sqrt
n = int(input())
l = map(int, input().split())
m = 1000000
p = [True] * (m + 1)
for i in range(2, m + 1):
	if not p[i]:
		continue
	for j in range(i, m // i + 1):
		p[j * i] = False
for i in l:
	a = sqrt(i)
	if a != int(a) or i == 1:
		print('NO')
		continue
	a = int(a)
	print('YES' if p[a] else 'NO')


from math import sqrt
from sys import stdin, stdout
n = int(stdin.readline())
v = [int(t) for t in stdin.readline().split()]
for x in v:
	if x == 1:
		ans = 'NO'
	else:
		r = int(sqrt(x))
		if r * r != x:
			ans = 'NO'
		else:
			x = r
			r = int(sqrt(x))
			ans = 'YES'
			for i in range(2, r + 1):
				if x % i == 0:
					ans = 'NO'
					break
	stdout.write(ans)
	stdout.write('\n')


B = []
n = 10 ** 6 + 4
prime = [True for i in range(n + 1)]
p = 2
while p * p <= n:
	if prime[p] == True:
		for i in range(p * p, n + 1, p):
			prime[i] = False
	p = p + 1
for p in range(2, n):
	if prime[p]:
		B.append(p)

def BS(B, x, l, h):
	if h >= l:
		m = (h + l) // 2
		if x > B[m]:
			return BS(B, x, m + 1, h)
		elif x < B[m]:
			return BS(B, x, l, m - 1)
		else:
			return True
	return False
N = int(input())
A = list(map(int, input().split()))
for i in A:
	j = i ** 0.5
	if j == int(j) and j < 1000000:
		if BS(B, j, 0, len(B)):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

class Prime:

	def __init__(self, n):
		self.M = m = int(math.sqrt(n)) + 10
		self.A = a = [True] * m
		a[0] = a[1] = False
		self.T = t = []
		for i in range(2, int(math.sqrt(m)) + 1):
			if not a[i]:
				continue
			t.append(i)
			for j in range(i * i, m, i):
				a[j] = False

	def is_prime(self, n):
		return self.A[n]

	def division(self, n):
		d = collections.defaultdict(int)
		for c in self.T:
			while n % c == 0:
				d[c] += 1
				n //= c
			if n < 2:
				break
		if n > 1:
			d[n] += 1
		return d.items()

	def sowa(self, n):
		r = 1
		for (k, v) in self.division(n):
			t = 1
			for i in range(1, v + 1):
				t += math.pow(k, i)
			r *= t
		return r

def main():
	n = I()
	a = LI()
	pr = Prime(10 ** 12)
	r = []
	for c in a:
		if c == 1:
			r.append('NO')
			continue
		t = int(c ** 0.5)
		f = 0
		for i in range(t - 1, t + 2):
			if c == i ** 2 and pr.is_prime(i):
				f = 1
		if f:
			r.append('YES')
		else:
			r.append('NO')
	return '\n'.join(r)
print(main())


def eratosfen(n):
	num = [True] * 10 ** 6
	(num[0], num[1]) = (False, False)
	for j in range(2, 1000000):
		if num[j] == True:
			for k in range(2 * j, 1000000, j):
				num[k] = False
	a = [j * j for j in range(1000000) if num[j] == True]
	return a

def binary(b, x):
	(l, r) = (0, long - 1)
	while l <= r:
		m = (l + r) // 2
		if a[m] == x:
			return True
		elif a[m] < x:
			l = m + 1
		else:
			r = m - 1
	return False
n = int(input())
a = eratosfen(n)
long = len(a)
for i in map(int, input().split()):
	print('YES' if binary(a, i) else 'NO')


import math

def seive_of_eratothenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
n = int(input())
a = list(map(int, input().split()))
primes = seive_of_eratothenes(1000000)
for i in a:
	if i == 4:
		print('YES')
	elif i % 2 == 0 or i < 4:
		print('NO')
	elif math.sqrt(i) == int(math.sqrt(i)):
		if primes[int(math.sqrt(i))] == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math

def get_primes(prime_supr):
	is_prime = [0] * 2 + [1] * prime_supr
	for i in range(2, int(math.sqrt(prime_supr)) + 1):
		if is_prime[i]:
			for j in range(i * i, prime_supr + 1, i):
				is_prime[j] = 0
	return is_prime
get_int = lambda : map(int, input().split())
n = int(input())
a = get_int()
is_prime = get_primes(1000000)
for i in a:
	x = int(math.sqrt(i))
	print(['NO', 'YES'][x * x == i and is_prime[x]])


from math import *
n = int(input())
N = 1000001
nums = map(int, input().split(' '))
sieve = [True] * N
prime = {2}
for i in range(2, N, 2):
	sieve[i] = False
for i in range(3, N, 2):
	if not sieve[i]:
		continue
	prime.add(i)
	for j in range(i * i, N, i):
		sieve[j] = False

def is_t_prime(n):
	f = floor(sqrt(n))
	c = ceil(sqrt(n))
	if f == c and f in prime:
		return True
	else:
		return False
for n in nums:
	if is_t_prime(n):
		print('YES')
	else:
		print('NO')