#include <bits/stdc++.h>

using namespace std;

int main(){
    int q;
    cin >> q;
    string test = "hackerrank";
    int testi;
    for(int a0 = 0; a0 < q; a0++){
        string s;
        cin >> s;
        // your code goes here
        testi=0;
        for(int i=0;i<s.size();++i){
            if(s[i]==test[testi]){
               ++testi;
            }
            if(testi==10)
                break;
        }
        if(testi==10)
            cout << "YES\n";
        else
            cout << "NO\n";
    }
    
    return 0;
}