#include <bits/stdc++.h>

using namespace std;

int main(){
    int q;
    cin >> q;
    char c[10]={'h','a','c','k','e','r','r','a','n','k'};
    for(int a0 = 0; a0 < q; a0++){
        string s;
        cin >> s;
        int i=0;
        for(int j=0;j<s.length();j++)
            {
            if(s.at(j)==c[i])
                {
                i++;
            }
            if(i==10){break;}
        }
        if(i==10)
            {
            cout<<"YES\n";
        }
        else
            {
            cout<<"NO\n";
        }
        // your code goes here
    }
    return 0;
}