def solve(n): if n == 1: print("Yes") else: print("No") c = 0 n %= 100 x = n**4 + 4 while x % 10 == 0: x //= 10 c += 1 print(c) for _ in range(int(input())): n = int(input()) solve(abs(n))