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(); boolean check = true; for(int a0 = 0; a0 < q; a0++){ HashMap map = new HashMap(); map.put('h',1); map.put('a',2); map.put('c',1); map.put('k',2); map.put('e',1); map.put('r',2); map.put('n',1); HashMap order = new HashMap(); String s_temp = in.next(); String s = s_temp.toLowerCase(); if(s.matches(".*h.*a.*c.*k.*e.*r.*r.*a.*n.*k.*")) System.out.println("YES"); else System.out.println("NO"); } } }