#include<iostream>
#include<string>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        char c;
        string s ("hackerrank"),s1;
        cin>>s1;
        for(int i=0;i<10;i++)
        {
            c=s[i];
            for(int j=0;s1[j]!='\0';j++)
            {
                if(c==s1[j])
                s[i]='0';    
            }    
        }    
        int l=0;
        for(int i=0;i<10;i++)
        {
            if(s[i]!='0')
            l=1;    
        }    
        if(l==0)
         cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
}