#!/bin/python

import sys


q = int(raw_input().strip())
for a0 in xrange(q):
    hack = list('hackerrank')
    s = raw_input().strip()
    # your code goes here
    for ch in s:
        if ch == hack[0]:
            hack.pop(0)
            if hack == []:
                break
    if hack == []:
        print 'YES'
    else:
        print 'NO'