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