def prcsInd(s, ref) : if len(ref) > 0 : if len(s) > 0 : i = s.find(ref.pop(0)) if i > -1 : return prcsInd(s[i+1:], r) else : return False else : return False else : return True q = int(input().strip()) for _ in range(q): s = input() r = list('hackerrank') if prcsInd(s, r) : print('YES') else : print('NO')