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(); for(int a0 = 0; a0 < q; a0++){ String s = in.next(); if (s.equals("hackerrank")) System.out.println("YES"); else if (s.length() < 10) System.out.println("NO"); else if (s.length() < 11 && !s.equals("hackerrank")) System.out.println("NO"); else { String temp = ""; char[] bunteh = s.toCharArray(); for (int f = 0; f < bunteh.length; f++) { if (bunteh[f] == 'h' && temp.length() == 0) temp += "h"; else if (bunteh[f] == 'a' && temp.length() == 1) temp += "a"; else if (bunteh[f] == 'c' && temp.length() == 2) temp += "c"; else if (bunteh[f] == 'k' && temp.length() == 3) temp += "k"; else if (bunteh[f] == 'e' && temp.length() == 4) temp += "e"; else if (bunteh[f] == 'r' && (temp.length() == 5 || temp.length() == 6)) temp += "r"; else if (bunteh[f] == 'a' && temp.length() == 7) temp += "a"; else if (bunteh[f] == 'n' && temp.length() == 8) temp += "n"; else if (bunteh[f] == 'k' && temp.length() == 9) temp += "k"; } if (temp.equals("hackerrank")) System.out.println("YES"); else System.out.println("NO"); } } } }