#!/bin/python3 import sys import re q = int(input().strip()) for a0 in range(q): s = input().strip() hIndex = s.find("h") if hIndex != -1: aIndex = s.find("a", hIndex) if aIndex != -1: cIndex = s.find("c", aIndex) if cIndex != -1: kIndex = s.find("k", cIndex) if kIndex != -1: eIndex = s.find("e", kIndex) if eIndex != -1: rIndex = s.find("r", eIndex) if rIndex != -1: rIndex = s.find("r", rIndex+1) if rIndex != -1: aIndex = s.find("a", rIndex) if aIndex != -1: nIndex = s.find("n", aIndex) if nIndex != -1: kIndex = s.find("k", nIndex) if kIndex != -1: print("YES") continue # go to next query print("NO")