import math
def is_prime(val):
if val <= 1:
return False
if val %2 == 0 and val != 2:
return False
upbound = int(math.sqrt(val))
for i in range(2, upbound+1):
if val % i == 0:
return False
return True
n = int(input())
for _ in range(n):
try:
val = int(input())
except:
break
print('Yes' if is_prime(val) else 'No')