#include <bits/stdc++.h>

using namespace std;

int main(){
    int q;
    char main[] ="hackerrank";
    cin >> q;
    for(int a0 = 0; a0 < q; a0++){
        string s;
        cin >> s;
        int j=0;
    for(int i=0;i<s.length();i++){
        if(s[i]==main[j])
            j++;
    }
    j==10?cout<<"YES":cout<<"NO";
        cout<<"\n";
        // your code goes here
    }
    
    
    
    return 0;
}