import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static final String H = "hackerrank"; public static void main(String[] args) { Scanner in = new Scanner(System.in); int q = in.nextInt(); List strings = new ArrayList<>(); for(int a0 = 0; a0 < q; a0++){ strings.add(in.next()); } for(String string : strings) { int lastIndex = -1; for(int i = 0; i < H.length(); i++) { int index = string.indexOf(H.charAt(i), lastIndex + 1); if (index == -1) { System.out.println("NO"); break; } else if(i == H.length() - 1) { System.out.println("YES"); } else { lastIndex = index; } } } } }