#!/bin/python3 import sys q = int(input().strip()) for a0 in range(q): s = input().strip() checkstring = ['h','a','c','k','e','r','r','a','n','k'] s_list = list(s) k = 0 for i in range(len(s_list)): if k == 9: break if(s_list[i] == checkstring[k]): k = k + 1 elif not(k == 0): if(s_list[i] == checkstring[k-1]): continue else: k = 0 if k == 9: print("YES") else: print("NO") # your code goes here