import java.io.*; import java.util.*; 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(); hackerRank(s); } in.close(); } public static void hackerRank(String s){ char[] testF = {'h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k'}; int sLength = s.length(); int currIndex = 0; if(sLength < testF.length){ System.out.println("NO"); return; } else{ for(int i = 0; i < sLength; i++){ if(testF[currIndex] == s.charAt(i)){ currIndex++; if(currIndex == testF.length){ System.out.println("YES"); return; } } } System.out.println("NO"); } } }