#include <bits/stdc++.h>

using namespace std;

int main(){
    int q;
    cin >> q;
    string hack = "hackerrank";
    for(int a0 = 0; a0 < q; a0++){
        string s;
        cin >> s;
        int st = 0;
        for(int i = 0; s[i] != '\0' and st!=10; ++i)
            {
            if(s[i] == hack[st])
                st++;
        }
        if(st == 10)
            cout << "YES\n";
        else
            cout << "NO\n";
        // your code goes here
    }
    return 0;
}