import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static boolean isSubSequence(char str1[], char str2[], int m, int n) { if (m == 0) return true; if (n == 0) return false; if (str1[m-1] == str2[n-1]) return isSubSequence(str1, str2, m-1, n-1); return isSubSequence(str1, str2, m, n-1); } public static void main(String[] args) { Scanner in = new Scanner(System.in); int q = in.nextInt(); String k = "hackerrank"; for(int a0 = 0; a0 < q; a0++){ String s = in.next(); if(isSubSequence(k.toCharArray(),s.toCharArray(),k.length(),s.length())) System.out.println("YES"); else System.out.println("NO"); } } }