import java.util.Scanner;

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();
		            char[] p=s.toCharArray();
		            char x[]={'h','a','c','k','e','r','r','a','n','k'};
		            int j=0;
		            int flag=0;
		            for(int i=0;i<p.length;i++){
		            	if(p[i]==x[j] && j<x.length){
		            		flag++;
		            		j++;
		            	}
		            }
		            if(x.length==flag){
		            	System.out.println("YES");	
		            }else{
		            	System.out.println("NO");
		            }

		}
	}
}