#include <bits/stdc++.h>

using namespace std;
bool isSubSequence(string str1, string str2, int m, int n)
{
   int j = 0; // For index of str1 (or subsequence
 
   // Traverse str2 and str1, and compare current character 
   // of str2 with first unmatched char of str1, if matched 
   // then move ahead in str1
   for (int i=0; i<n&&j<m; i++)
       if (str1[j] == str2[i])
         j++;
 
   // If all characters of str1 were found in str2
   return (j==m);
}
 
int main(){
    int q;
    cin >> q;
    string s1="hackerrank",s2;
    for(int a0 = 0; a0 < q; a0++){
        cin >> s2; 
        if((isSubSequence(s1,s2,10,s2.size())==1))
            cout << "YES"; 
        else
            cout << "NO";
        cout << "\n";
        
        // your code goes here
    }
    return 0;
}