#!/bin/python3 import sys import re q = int(input().strip()) h = "h.*a.*c.*k.*e.*r.*r.*a.*n.*k" for a0 in range(q): s = input().strip() # your code goes here prog = re.compile(h) result = prog.search(s) if result != None: print("YES") else: print("NO")