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) { char[] word = {'h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k'}; int numChars = word.length; Scanner in = new Scanner(System.in); int q = in.nextInt(); for(int a0 = 0; a0 < q; a0++){ String s = in.next(); int len = s.length(); int wordPos = 0; int strPos = 0; while (wordPos < numChars && strPos < len) { if (s.charAt(strPos) == word[wordPos]) { wordPos++; } strPos++; } if (wordPos == numChars) { System.out.println("YES"); } else { System.out.println("NO"); } } } }