#!/bin/python import sys import re q = int(raw_input().strip()) for a0 in xrange(q): s = raw_input().strip() match = re.search("h.*?a.*?c.*?k.*?e.*?r.*?r.*?a.*?n.*?k",s) if match: print "YES" else: print "NO"