#!/bin/python3

import sys


q = int(input().strip())
code = "hackerrank"
for a0 in range(q):
    s = input().strip()
    # your code goes here
    j = 0
    for i in range(len(s)):
        if (code[j]) == s[i]:
            j += 1
    if (j == len(code)):
        print('YES')
    else:
        print('NO')