#!/bin/python3

import sys

word = ['h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k']
q = int(input().strip())
for a0 in range(q):
    s = input().strip()
    # your code goes here
    if(all(requested_word in s for requested_word in word)):
    	print('YES')
    else:
    	print('NO')