import sys result=[] q = int(raw_input().strip()) for a0 in xrange(q): s = raw_input().strip() wor=['h','a','c','k','e','r','r','a','n','k'] i=0 for c in s: #print(i) if len(wor)>0: if c==wor[i]: wor.remove(c) #i=i+1 if not wor: result.append('YES') else: result.append('NO') j=0 while j < len(result): print result[j]; j=j+1; # your code goes here