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(); char[] needle = { 'h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k'}; for(int a0 = 0; a0 < q; a0++){ String s = in.next(); boolean found = false; int needleIndex = 0; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == needle[needleIndex]) { needleIndex++; if (needleIndex == needle.length) { found = true; break; } } } System.out.println(found ? "YES" : "NO"); } } }