def isPrime(n): p = 2 while p * p <= n: if n % p == 0:return False p += 1 return n > 1 n = int(input()) for _ in range(n): m = int(input()) if isPrime(m):print("Yes") else:print("No")