#!/bin/python

import sys
test_list = "hackerrank"
test_set = set(test_list)
flag = 0
q = int(raw_input().strip())
for a0 in xrange(q):
    s = raw_input().strip()
    for i in test_set:
        if s.count(i) < test_list.count(i) :
            flag=1
    if flag==0 :
        print "YES"
    else:
        print "NO"
          
            
    # your code goes here