I,P=input,print for t in range(int(I())): N=int(I()) if abs(N)-1: N,c=N**4+4,0 while N%10<1:N,c=N//10,c+1 P("No"),P(c) else:P("Yes"),P(0)