#include <bits/stdc++.h>

using namespace std;

int main(){
    int q;
    cin >> q;
    for(int a0 = 0; a0 < q; a0++){
        string s;
        cin >> s;
        string s1 = "hackerrank";
        long long j = 0;
        for(long long i = 0; i < s.length(); i++){
            if(s[i] == s1[j]){
                j++;
            }
            if(j == 10)
                break;
        }
        if(j == 10)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
        // your code goes here
    }
    return 0;
}