#!/bin/python3

import sys
to_find = [c for c in 'hackerrank']

q = int(input().strip())
for a0 in range(q):
    s = input().strip()
    # your code goes here
    finding = 0
    for c in s:
        if to_find[finding] == c:
            finding += 1
            if finding == len(to_find):
                print("YES")
                break
    else:
        print("NO")