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 sc = new Scanner(System.in); int q = sc.nextInt(); for(int a0 = 0; a0 < q; a0++){ String s = sc.next(); int len=s.length(); int i=0; int count=0; while(i<=len-1){ char ch=s.charAt(i); if(ch=='h'&&count==0){ count++; } else if(ch=='a'&&count==1){ count++; } else if(ch=='c'&&count==2){ count++; } else if(ch=='k'&&count==3){ count++; } else if(ch=='e'&&count==4){ count++; } else if(ch=='r'&&count==5){ count++; } else if(ch=='r'&&count==6){ count++; } else if(ch=='a'&&count==7){ count++; } else if(ch=='n'&&count==8){ count++; } else if(ch=='k'&&count==9){ count++; } else if(count==10) break; i++; } if(count==10) System.out.println("YES"); else System.out.println("NO"); } } }