#!/bin/python3 import sys q = int(input().strip()) for a0 in range(q): s = input().strip() sortedS = sorted(s) sortedS = list(sortedS) h = "hackerrank" sortH = sorted(h) sortH = list(sortH) setH = set(sortH) unionH = setH.union(setH) unionH = list(unionH) test = [] for items in unionH: if (sortedS.count(items))>=(sortH.count(items)): test.append("y") else: test.append("n") if test.count("y") == len(test): print ("YES") else: print ("NO")