#!/bin/python3 import sys def check(s, to_find="hackerrank"): last_index = -1 for letter in to_find: idx = s.find(letter, last_index + 1) if idx != -1: last_index = idx else: return False return True q = int(input().strip()) for a0 in range(q): s = input().strip() # your code goes here print("YES" if check(s) else "NO")