import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static char[] a = "hackerrank".toCharArray(); public static void main(String[] args) { Scanner in = new Scanner(System.in); int q = in.nextInt(); for(int a0 = 0; a0 < q; a0++){ char[] b = in.next().toCharArray(); if (contains(b,0, a, 0)) { System.out.println("YES"); } else { System.out.println("NO"); } } } static boolean contains(char[] b, int startb, char[] a, int starta) { if (starta >= a.length) return true; int i = find(b, startb, a[starta]); if (i < 0) return false; return contains(b, i+1, a, starta+1); } static int find(char[] b, int startb, char ch) { for (int i = startb; i < b.length; i ++) { if (b[i] == ch) return i; } return -1; } }