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(); String ideal = "hackerrank"; String out = "YES"; for(int a0 = 0; a0 < q; a0++){ String s = in.next(); char[] array = s.toCharArray(); char[] idealArray = ideal.toCharArray(); List list = new ArrayList<>(); for (int i = 0; i < array.length; i++) { list.add(array[i]); } out = "YES"; for (int j = 0; j < idealArray.length; j++) { if(list.indexOf(idealArray[j]) == -1) { out = "NO"; } else { list.remove(list.indexOf(idealArray[j])); } } System.out.println(out); } } }