n = int(input()) for i in range(n): d = int(input()) print("Y" if d%45==0 else "N")