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 s = new Scanner(System.in); int numLines = Integer.parseInt(s.nextLine()); char[] wanted = { 'h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k' }; while (s.hasNextLine()) { char[] word = s.nextLine().toCharArray(); int ndx = 0; boolean yes = false; for (int i = 0; i< word.length;i++){ if (word[i]==wanted[ndx]){ ndx++; if (ndx>=10){ System.out.println("YES"); yes=true; break; } } } if(!yes){ System.out.println("NO"); } } } }