#!/bin/python3 import sys nq = int(input().strip()) h = 'hackerrank' for q in range(nq): s = input().strip() i = 0 j = 0 while i < len(h) and j < len(s): if h[i] == s[j]: i += 1 j += 1 else: j += 1 if i ==len(h): print('YES') else: print('NO')