#!/bin/python3 import sys q = int(input().strip()) test = "hackerrank" for a0 in range(q): s = input().strip() # your code goes here chars = list(s) index = 0 for c in chars: if c == test[index]: index += 1 if index == len(test): break print('YES' if index == len(test) else 'NO')