import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution 
{
    public static void main(String[] args) 
    {
        int countA=0,countK=0,countR=0;
        Scanner in = new Scanner(System.in);
        int q = in.nextInt();
        for(int a0 = 0; a0 < q; a0++)
        {
            String s = in.next();
            char[] temp=s.toCharArray();
            for(int i=0;i<temp.length;i++)
            {
                for(int j=0;j<temp.length;j++)
                {
                    if(temp[j]=='r')
                    {
                        countR++;
                    }
                    else if(temp[j]=='k')
                    {
                        countK++;
                    }
                    else if(temp[j]=='a')
                    {
                        countA++;
                    }
                }
            }
            if(s.contains("h") && s.contains("c") && s.contains("e") && s.contains("n") && countA>=2 && countR>=2 && countK>=2)
            {
                System.out.println("YES");
            }
            else
            {
                System.out.println("NO");
            }
        }
    }
}