#!/bin/python3 import sys def checkSubsequence(s, word): r='' w=list(word) for l in s: if not w: break if w[0]==l: w.pop(0) if w: r='NO' else: r='YES' return r q = int(input().strip()) for a0 in range(q): s = input().strip() # your code goes here print(checkSubsequence(s,'hackerrank'))