import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int count,flag=0; int q = in.nextInt(); char[] H= {'h','a','c','k','e','r','n'}; for(int a0 = 0; a0 < q; a0++){ String s = in.next(); for(int i =0;i<7;i++){ if(i==1||i==3||i==5) count =2; else count =1; for(int j =0 ; j0) flag=1; } if(flag !=0) System.out.println("NO"); else System.out.println("YES"); } } }