#!/bin/python3

import sys

def contains_word(string, word):
    word_idx = 0
    for str_idx in range(len(string)):
        current_char = string[str_idx]
        char_to_match = word[word_idx]
        if current_char == char_to_match:
            word_idx += 1
    return word_idx == (len(word))

q = int(input().strip())
for a0 in range(q):
    s = input().strip()
    print("YES" if contains_word(s, 'hackerrank') else "NO")