#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,t,i,j,k;
    cin>>t;
    while(t--)
    {
       string s;
        cin>>s;
        string t="hackerrank";
        i=0;j=0;
        while(i<t.size()&&j<s.size())
        {
            while(s[j]!=t[i]&&j<s.size())
            j++;
            if(j<s.size())
            {i++;j++;}
        }
        if(i>=t.size())
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    return 0;
}