#include <bits/stdc++.h>

using namespace std;
//const string pattern = "hackerrank";
const regex pattern ("h.*a.*c.*k.*e.*r.*r.*a.*n.*k"); 

int main(){
    int q;
    cin >> q;
    for(int a0 = 0; a0 < q; a0++){
        string s;
        cin >> s;
        if (regex_search(s, pattern)){
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
        // your code goes here
    }
    return 0;
}