using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {

    static void Main(String[] args) {
        int[] arr = new int[7]{1,2,1,2,1,2,1} ;
        int[] temp;
        int q = Convert.ToInt32(Console.ReadLine());
        for(int a0 = 0; a0 < q; a0++){
            temp = new int[7]{0,0,0,0,0,0,0};
            string s = Console.ReadLine();
            // your code goes here
            foreach(char C in s.ToCharArray()){
               if (C == 'h'){
                   temp[0]++;
               }else if (C == 'a'){
                   temp[1]++;
               }else if (C == 'c'){
                   temp[2]++;
               }else if (C == 'k'){
                   temp[3]++;
               }else if (C == 'e'){
                   temp[4]++;
               }else if (C == 'r'){
                   temp[5]++;
               }else if (C == 'n'){
                   temp[6]++;
               }
            }
            bool isSuccess = false;
            for (int i = 0; i < 7; i++ ){
                if ((arr[i] - temp[i]) < 0 ){
                    isSuccess = true;
                        break;
                }
            }
            Console.WriteLine(isSuccess? "YES":"NO");
    }
    }
}