#!/bin/python3 import sys x = [] def f(word): c = 0 hack = list("hackerrank") letters = list(word) for letter in hack: if letter in letters: c+=1 letters[:letters.index(letter)+1] = [] if c == 10: return "YES" return "NO" q = int(input().strip()) for a0 in range(q): s = input().strip() # your code goes here print(f(s))