#include<bits/stdc++.h>
using namespace std;

string temp="hackerrank";

bool check(string s)
{
    int k=0;
    for(int i=0; k<temp.size()&&i<s.size(); i++)
        if(s[i]==temp[k])
            k++;
    if(k==temp.size())
        return true;
    return false;
}

int main()
{
    ios_base::sync_with_stdio(false);
    int q;
    cin>>q;
    while(q--)
    {
        string s;
        cin>>s;
        if(check(s))
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
}