#!/bin/python import sys q = int(raw_input().strip()) for a0 in xrange(q): s = raw_input().strip() # your code goes here word = [x for x in "hackerrank"] for letter in s: try: if letter == word[0]: word.pop(0) except IndexError: break if len(word) == 0: print "YES" else: print "NO"