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 queries = in.nextInt(); for (int q = 0; q < queries; q++) { String str = in.next(); //hackerrank is 10 letters long boolean foundH = false, foundA = false, foundC = false, foundK = false, foundE = false, foundR = false, foundR2 = false, foundA2 = false, foundN = false, foundK2 = false; for (int i = 0; i < str.length(); i++) { if (!foundH) { if (str.substring(i, i+1).equalsIgnoreCase("h")) { foundH = true; } } else if (!foundA) { if (str.substring(i, i+1).equalsIgnoreCase("a")) { foundA = true; } } else if (!foundC) { if (str.substring(i, i+1).equalsIgnoreCase("c")) { foundC = true; } } else if (!foundK) { if (str.substring(i, i+1).equalsIgnoreCase("k")) { foundK = true; } } else if (!foundE) { if (str.substring(i, i+1).equalsIgnoreCase("e")) { foundE = true; } } else if (!foundR) { if (str.substring(i, i+1).equalsIgnoreCase("r")) { foundR = true; } } else if (!foundR2) { if (str.substring(i, i+1).equalsIgnoreCase("r")) { foundR2 = true; } } else if (!foundA2) { if (str.substring(i, i+1).equalsIgnoreCase("a")) { foundA2 = true; } } else if (!foundN) { if (str.substring(i, i+1).equalsIgnoreCase("n")) { foundN = true; } } else if (!foundK2) { if (str.substring(i, i+1).equalsIgnoreCase("k")) { foundK2 = true; break; } } } if (foundK2) System.out.println("YES"); else System.out.println("NO"); } } }