#!/bin/python3 import sys from collections import Counter hack = {'h': 1, 'a': 2, 'c': 1, 'k': 2, 'e': 1, 'r': 2, 'n': 1} q = int(input().strip()) for a0 in range(q): s = input().strip() # your code goes here b = list(s) count = Counter(b) for item in hack: if item not in count: print ('NO') break elif hack[item] > count[item]: print('NO') break else: print('YES') break