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(); for(int a0 = 0; a0 < q; a0++){ String s = in.next(); String reqd = "hackerrank"; int ptr = 0; for(int i = 0; i < s.length()-1; i++){ if(ptr == 9){ System.out.println("YES"); break; } else{ if(s.charAt(i) == reqd.charAt(ptr)){ ptr++; } } } if(ptr < 9){ System.out.println("NO"); } else{ System.out.println("YES"); } } } }