q = int(input()) hacker = "hackerrank" res = [] for _ in range(q): s = input() index = -1 found = 0 for h in hacker: if h in s: found += 1 index = s.index(h) else: break if len(hacker) == found: res.append("YES") else: res.append("NO") for r in res: print(r)