import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static final String HR = "hackerrank"; 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(); System.out.println(isHr(s)); // your code goes here } } private static String isHr(String s) { int hrIndex = 0, sIndex = 0; boolean passed = false; while(sIndex < s.length()){ if (hrIndex + 1 == HR.length()){ passed = true; break; } else if (HR.charAt(hrIndex) == s.charAt(sIndex)) { hrIndex++; } sIndex++; } return passed ? "YES" : "NO"; } }