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) { Scanner in = new Scanner(System.in); int q = in.nextInt(); char[] aWord = {'h','a','c','k','e','r','n'}; int nTimes=0; for(int a0 = 0; a0 < q; a0++){ String s = in.next(); // your code goes here for (char i:aWord){ if(s.indexOf(i) >= 0){ nTimes++; if(s.lastIndexOf(i) == s.indexOf(i) ){ }else{ nTimes++; } } //if(s.lastIndexOf(i) >= 0){ // nTimes++; //} } if(nTimes >= 11){ System.out.println("YES"); }else{ System.out.println("NO"); } nTimes = 0; } } }