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


int main() {
    int q;
    cin>>q;
    string s="hackerrank";
    for(int i=0;i<q;++i){
    string c;
    int b=0,e=0;
    cin>>c;
        for(int j=0;j<s.size();++j){
            for(int k=j;k<c.size();++k){
        if(s[j]==c[k]){
           ++e;
            break;}
                
            }}
    if(e==s.size())
        cout<<"YES"<<endl;
        else
        cout<<"NO"<<endl;}
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    return 0;
}