using System;
using System.Text;

class Solution
{
    static void Main(String[] args)
    {
        int q = Convert.ToInt32(Console.ReadLine());
        StringBuilder outputBuilder = new StringBuilder();

        for (int a0 = 0; a0 < q; a0++)
        {
            string s = Console.ReadLine();
            // your code goes here

            if (IsHackerRank(s))
                outputBuilder.AppendLine("YES");
            else
                outputBuilder.AppendLine("NO");
        }

        Console.WriteLine(outputBuilder);

    }

    private static bool IsHackerRank(string s)
    {
        string hacker = "hackerrank";
        int hackerIndex = 0;

        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == hacker[hackerIndex])
                hackerIndex++;

            if (hackerIndex >= hacker.Length)
                return true;
        }

        return false;

    }
}