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 q = in.nextInt(); for(int a0 = 0; a0 < q; a0++){ String s = in.next(); // your code goes here char[] hackerrank = new char[]{'h','a','c','k','e','r','r','a','n','k'}; char[] charArray = s.toCharArray(); int charIndex=0; boolean verified=true; for (int i=0; i < hackerrank.length; i++){ boolean foundLetter=false; Character hackerLetter= new Character(Character.toLowerCase(hackerrank[i])); for(int j = charIndex; j< charArray.length; j++){ Character letter = new Character(Character.toLowerCase(charArray[j])); int result = hackerLetter.compareTo(letter); if (result==0){ foundLetter=true; charIndex=j; charIndex++; break; } } if (!foundLetter){ verified=false; break; } } if(verified){ System.out.println("YES"); } else{ System.out.println("NO"); } } } }