#!/bin/python3 import sys import re regex = re.compile('h.*a.*c.*k.*e.*r.*r.*a.*n.*k.*') q = int(input().strip()) for a0 in range(q): s = input().strip() test = re.search(regex, s) if test: print("YES") else: print("NO")