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

int n;
string h = "hackerrank";

int main() {
    cin >> n;
    
    while (n--){
        string s;
        cin >> s;
        
        int it = 0;
        for (int i = 0; i < (int)s.size() && it < (int)h.size(); i++){
            if (s[i] == h[it])
                it++;
        }
        
        if (it == (int)h.size())
            cout << "YES\n";
        else
            cout << "NO\n";
    }
    return 0;
}