#!/bin/python3 import sys q = int(input().strip()) for a0 in range(q): s = input().strip() test = 'hackerrank' copy = '' for char in s: if char == test[0]: copy += char test = test[1:] if copy == 'hackerrank': print("YES") else: print("NO")