t = int(input()) for i in range(t): x = int(input()) print('Y' if x % 45 == 0 else 'N')