#!/bin/python3 # re is possibly too slow import sys import re pattern = r'\b.*h.*a.*c.*k.*e.*r.*r.*a.*n.*k.*\b' q = int(input().strip()) for a0 in range(q): s = input().strip() match = re.match(pattern, s) if match is not None: print("YES") else: print("NO")