import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int q = in.nextInt(); char[] hr = "hackerrank".toCharArray(); for(int a0 = 0; a0 < q; a0++){ char[] test = in.next().toCharArray(); int i = 0, j = 0; while (i < hr.length && j < test.length){ if (hr[i] == test[j]){ i++; j++; } else { j++; } } if (i == hr.length) System.out.println("YES"); else System.out.println("NO"); } } }