#!/bin/python3 import sys q = int(input().strip()) for a0 in range(q): s = list(map(str,input().strip())) # your code goes here desire = ['h','a','c','k','e','r','r','a','n','k'] for c in range(len(s)): if s[c]==desire[0]: del desire[0] if desire ==[]: print("YES") break if desire != []: print("NO")