#!/bin/python3 import sys target = ('h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k') target_state = len(target) current_state = 0 q = int(input().strip()) for a0 in range(q): current_state = 0 s = input().strip() for c in s: if c == target[current_state]: current_state += 1 if current_state == target_state: break if current_state == target_state: print("YES") else: print('NO')