#!/bin/python

import sys


q = int(raw_input().strip())
for a0 in xrange(q):
    s = raw_input().strip()
    word = ['h','a','c','k','e','r','r','a','n','k']

    idx = 0
    isSubsequence = False;
    for c in s:
        if (c == word[idx] and idx < len(word)):
            idx += 1
        else:
            pass
        if (idx == len(word)):
            isSubsequence = True
            break
            
    if (isSubsequence):
        print "YES"
    else:
        print "NO"