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();
            // your code goes here
            char[] s_arr = s.toCharArray();
            
            String h = "hackerrank";
            char[] h_arr = h.toCharArray();
            
            String result = "YES";
            boolean notFound = false;
            
            for (int i = 0; i < h_arr.length; ++i){

                if (notFound)
                    break;
                    
              //  System.out.println(Arrays.toString(h_arr));
                //System.out.println(h_arr[i]);
                
                for (int j = 0; j < s_arr.length; ++j){
                    
                    if (h_arr[i] == s_arr[j]){
                        s_arr[j] = '-';
                        notFound = false;
                        break;
                    }  
                    else
                        notFound = true;
                }
            }
                
            if (notFound)
                System.out.println("NO");
            else
                System.out.println("YES");
            
        }
    }
}