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) { String checkString = "hackerrank"; Scanner in = new Scanner(System.in); int q = in.nextInt(); if(q >=2 && q <= 100) { for(int a0 = 0; a0 < q; a0++){ String s = in.next(); int len = s.length(); if(len >= 10 && len <= 10000) { System.out.println(printOutput(s, checkString)); } } } } private static String printOutput(String s, String checkStr) { String output = "NO"; List inputList = addList(s.toCharArray()); List tempValues = addList(s.toCharArray()); char[] checkCharList = checkStr.toCharArray(); if(containsCheck(tempValues, checkCharList) && sequenceCheck(inputList, checkCharList)) { output = "YES"; } return output; } private static boolean sequenceCheck(List inputList, char[] checkCharList) { return true; } private static boolean containsCheck(List tempValues, char[] checkCharList) { boolean containsCheck = true; for(Character c : checkCharList) { if(!tempValues.contains(c)) { containsCheck = false; break; } else { tempValues.remove(c); } } tempValues.clea(); tempValues = null; return containsCheck; } private static List addList(char[] inList) { List outList = new ArrayList(); for(Character c : inList){ outList.add(c); } return outList; } }