#!/bin/python3 import sys q = int(input().strip()) for a0 in range(q): s = input().strip() # your code goes here tS = list("hackerrank") for item in reversed(s): if not tS: break if item == tS[-1]: tS.pop() if tS: print("NO") else: print("YES")