#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

string s;
string g = "hackerrank";
int n;

int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    cin>>n;
    while (n--) {
        cin>>s;
        int i = 0;
        int j = -1;
        for (; i < g.length(); ++i) {
            ++j;
            while (j < s.length() && s[j] != g[i]) ++j;
            if (j == s.length()) break;
        }
        
        if (i == g.length()) {
            cout<<"YES"<<"\n";
        } else cout<<"NO"<<"\n";
    }
    return 0;
}