#!/bin/python3 import sys q = int(input().strip()) for a0 in range(q): s = input().strip() # your code goes here h,a,c,k,e,r,n = 0, 0, 0, 0, 0, 0, 0 yes = False for i in range(len(s)): if s[i] == "h": h = h + 1 if s[i] == "a": a = a + 1 if s[i] == "c": c = c + 1 if s[i] == "k": k = k + 1 if s[i] == "e": e = e + 1 if s[i] == "r": r = r + 1 if s[i] == "n": n = n + 1 if h >= 1: if a >= 2: if c >= 1: if k >= 2: if e >= 1: if r >= 2: if n >= 1: yes = True if yes == True: print("YES") else: print("NO")