import java.util.*; import java.io.*; class rank { public static String lcs(String str1, String str2) { int l1= str1.length(); int l2= str2.length(); int arr[][]= new int[l1+1][l2+1]; for(int i= l1-1; i>=0; i--) { for(int j=l2-1; j>=0; j--) { if(str1.charAt(i)==str2.charAt(j)) { arr[i][j]= arr[i+1][j+1] +1; } else { arr[i][j]= Math.max(arr[i+1][j],arr[i][j+1]); } } } int i=0,j=0; StringBuffer sb= new StringBuffer(); while(i= arr[i][j+1]) { i++; } else { j++; } } return sb.toString(); } public static void main(String ar[]) { Scanner sc= new Scanner(System.in); int q= sc.nextInt(); while(q!=0) { String s= sc.next(); String h= "hackerrank"; String result= lcs(s,h); if(result.equals("hackerrank")==true) { System.out.println("YES"); } else { System.out.println("NO"); } q= q-1; } } }