#!/bin/python3 import sys import re rx = re.compile('.*'.join(list('hackerrank'))) q = int(input().strip()) for a0 in range(q): s = input().strip() print('YES' if rx.search(s) else 'NO')