#!/bin/python3 import sys def isIn(s): chars = "hackerrank" last = 0 for c in chars: f = s.find(c, last) if f < 0: return False last = f+1 return True q = int(input().strip()) for a0 in range(q): s = input().strip() # your code goes here if isIn(s): print("YES") else: print("NO")