#!/bin/python3

import sys

def hacker(s):
    x = list(s)
    hackerrank = "hackerrank"
    result = "YES"
    for char in hackerrank:
        if char in x:
            x.remove(char)
        else:
            result = "NO"
    print (result)

q = int(input().strip())
for a0 in range(q):
    s = input().strip()
    y = s.split("\n")
    for word in y:
        hacker(word)
    # your code goes here