#include <iostream>
#include <string>
using namespace std;

int main() 
{
    int n;
    cin>>n;
    
    string txt;
    string s = "hackerrank";
    
    while(n--)
    {
        cin>>txt;
        int pos = -1;
        bool ok = true;
        for (int i = 0 ; ok && i != s.size() ; i++) {
            ok = (pos = txt.find(s[i], pos+1)) != string::npos;
        }
        cout<< (ok ? "YES" : "NO") << endl;
    }
    return 0;
}