#!/bin/python import sys def test(s): try: for char in "hackerrank": i = s.index(char) s = s[i+1:] return "YES" except: return "NO" q = int(raw_input().strip()) for a0 in xrange(q): s = raw_input().strip() print test(s)