using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {

    static void Main(String[] args) {
        int q = Convert.ToInt32(Console.ReadLine());
        for(int a0 = 0; a0 < q; a0++){
            string s = Console.ReadLine();
            // your code goes here
            if(Subseq(s,"hackerrank"))
               {Console.WriteLine("YES");}
               else
               Console.WriteLine("NO");
        }
    }
    public static bool Subseq(string src,string pat)
{
        bool got = false;
        int  i = 0;
    foreach(char a in src)
        {
        //Console.Error.WriteLine(a+" - "+pat[i]);
        if(a.Equals(pat[i]))
            {
            i++;
        }
    }
        if(i == pat.Length)
            got = true;
    return got;    
}
}