#!/bin/python import sys w = 'hackerrank' q = int(raw_input().strip()) for a0 in xrange(q): s = raw_input().strip() # your code goes here i = 0 j = 0 while j < len(w) and i < len(s): if s[i] == w[j]: i += 1 j += 1 else: i += 1 if j == len(w): print 'YES' else: print 'NO'