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(); String HACKERRANK = "hackerrank"; for(int a0 = 0; a0 < q; a0++){ String s = in.next(); // your code goes here boolean charFound = false; for (int i =0; i < HACKERRANK.length(); i++) { char test = HACKERRANK.charAt(i); if (s.indexOf(test) >= 0) { if (i != 9) { s = s.substring(s.indexOf(test)+1, s.length()); } else { charFound = true; } } else { charFound = false; break; } } System.out.println(charFound ? "YES" : "NO"); } } }