#!/bin/python3 import sys def ishackerrank(s): pos = [] pos.append(s.find('h')) i = 0 for char in 'ackerrank': i += 1 pos.append(s.find(char,pos[i-1]+1)) for i in pos: if i == -1: return False return True q = int(input().strip()) for a0 in range(q): s = input().strip() # your code goes here if ishackerrank(s): print ('YES') else: print ('NO')