#!/bin/python import sys def find_substr(substr, fullstr): # Find the first character of substr index = fullstr.find(substr[0]) if index == -1: return False if len(substr) == 1: return True if len(fullstr) <= (index + 1): return False return find_substr(substr[1 : ], fullstr[index + 1 : ]) pattern = 'hackerrank' q = int(raw_input().strip()) for a0 in xrange(q): s = raw_input().strip() print 'YES' if find_substr(pattern, s) else 'NO'