import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc=new Scanner(System.in); int T=sc.nextInt(); while(T-->0) { int x=sc.nextInt(); System.out.println(x%45==0?"Y":"N"); } } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }