#!/bin/python3 import sys from collections import OrderedDict q = int(input().strip()) for a0 in range(q): s = list(input().strip()) ans = list("hackerrank") results = "" sol = [0,1,2,3,4,5,6,7,8,9] holding = [] #index through s and get placement for each letter in ans i = 0 while i < len(ans): for l in s: if l == ans[i]: holding.append(i) i += 1 #determine is rank is in order eval = list(OrderedDict.fromkeys(holding)) if eval == sol: results = 'YES' else: results = 'NO' print (results)