import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Sol { public static void main(String[] args) { Scanner in = new Scanner(System.in); int q = in.nextInt(); String r = "hackerrank"; boolean v = true; for(int a0 = 0; a0 < q; a0++){ String s = in.next(); int o = 0; for (int i = 0; i < r.length(); i++) { for (int j = o; j < s.length(); j++) { if(r.charAt(i) == s.charAt(j)){ o = j; v = true; break; } else { v = false; } } } if(v){ System.out.println("YES"); } else { System.out.println("NO"); } } } }