#!/bin/python3 import sys data = 'hackerrank' q = int(input().strip()) for a0 in range(q): index = 0 found = False s = input().strip() for i in range(len(s)): if s[i] == data[index]: index += 1 if index >= len(data): print('YES') found = True break if not found: print('NO')