#!/bin/python3 q = int(input().strip()) for i in range(q): s = input().strip() pins = set('hackerrank') pinl = list('hackerrank') for c in s: if c in pins and len(pinl) > 0: if pinl[0] == c: pinl = pinl[1::] if len(pinl) == 0: print("YES") else: print("NO")