#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
using namespace std;


int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */ 
    int n;
    cin>>n;
    int i;
    for(i=0;i<n;i++)
        {
        char* a=(char *)malloc(sizeof(char)*10000);
        cin>>a;
        int len=strlen(a);
        char b[10];
        b[0]='h';
        b[1]='a';
        b[2]='c';
        b[3]='k';
        b[4]='e';
        b[5]='r';
        b[6]='r';
        b[7]='a';
        b[8]='n';
        b[9]='k';
        int pointer=0;
        int j;
        for(j=0;j<len;j++)
            {
            if(a[j]==b[pointer] && pointer<10)
                {
                pointer++;
            }
            if(pointer>=10)
                break;
        }
        if(pointer==10)
            cout<<"YES";
        else 
            cout<<"NO";
            cout<<endl;
        
    }
    return 0;
}