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();
        for(int a0 = 0; a0 < q; a0++){
            String s = in.next();
            // your code goes here
        char ch[]={'h','a','c','k','e','r','r','a','n','k'};
            int count=0,index=0;
            int l=s.length();
            for(int i=0;i<10;i++)
                {
                String str=s.substring(index,l);
                int pos=str.indexOf(ch[i]);
               
                if(pos>=0)
                 {
                 count++;
                 index=pos+1;   
                }
                           }
             if(count==10)
                 System.out.println("YES");
            else
                 System.out.println("NO");
        }
    }}