#!/bin/python3 import sys q = int(input().strip()) string = list('hackerrank') for a0 in range(q): s = input().strip() j = 9 # your code goes here for i in range(len(s)-1, -1, -1): if j >= 0: if s[i] == string[j]: j -= 1 print ("YES" if j <0 else "NO")