import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static boolean isSubSequence(String str1, String str2, int m, int n) { if (m == 0) return true; if (n == 0) return false; if (str1.charAt(m-1) == str2.charAt(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(); for(int a0 = 0; a0 < q; a0++){ String str1 = "hackerrank"; String str2 = in.next(); int m = str1.length(); int n = str2.length(); if(isSubSequence(str1, str2, m, n)) System.out.println("YES"); else System.out.println("NO"); } } }