import random def Miller_Rabin_test(num): if num == 2: return True if num == 1 or (num > 2 and num & 1 == 0): return False s, t = 0, num-1 while t & 1 == 0: s, t = s+1, t >> 1 a = random.randint(1, num-1) if pow(a, t, num) == 1: return True for i in range(0, s): if pow(a, pow(2, i) * t, num) == num-1: return True return False for _ in range(int(input())): N = int(input()) a = N ** 4 + 4 if all(Miller_Rabin_test(a) for _ in range(20)): print("Yes") else: print("No") c = 0 while a % 10 == 0: c += 1 a //= 10 print(c)