#!/bin/python import sys q = int(raw_input().strip()) for a0 in xrange(q): count = 0 s = raw_input().strip() t = "hackerrank" j = 0 for i in range(len(s)): if(s[i] == t[j]): count += 1 if(j == 9): break j += 1 if(count == 10): print "YES" else: print "NO"