for _ in range(int(input())): N = int(input()) if abs(N) == 1: print("Yes") else: print("No") c = 0 a = N ** 4 + 4 while a % 10 == 0: c += 1 a //= 10 print(c)