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[] charArray ={ 'h', 'a', 'c', 'k', 'e', 'r','r','a','n','k' }; for (int i = 0; i < charArray.length -1 ; i++) { s = findLetter(charArray[i],s); } if (s.compareTo("NO") == 0 ) System.out.println("NO"); else System.out.println("YES"); } } static String findLetter (char letter, String s) { int u = s.indexOf(letter); if (u > -1) return s = s.substring (0,u) + s.substring(u+1); else return "NO"; } }