#!/bin/python import sys def f(s): lastIndex = 0 for c in "hackerrank": try: lastIndex = s.index(c, lastIndex)+1 except: return False return True q = int(raw_input().strip()) for a0 in xrange(q): s = raw_input().strip() # your code goes here if f(s): print "YES" else: print "NO"