#!/bin/python import sys q = int(raw_input().strip()) for a0 in xrange(q): s = (raw_input().strip()).lower() result = True S = "hackerrank" loc = 0 l = len(s) while loc < l: if s[loc] == S[0]: loc += 1 S = S[1:] else: loc += 1 if(len(S) == 0): break if len(S) > 0: result = False if result == False: print "NO" else: print "YES"