#!/bin/python import sys q = int(raw_input().strip()) for a0 in xrange(q): s = raw_input().strip() # your code goes here letters = ['h','a','c','k','e','r','r','a','n','k'] j = 0 for i in s: if i == letters[j]: j += 1 if j == 10: print 'YES' else: print 'NO'