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 Map map1 = new HashMap<>(); String z = "hackerrank"; for (char c : z.toCharArray()) { Integer count = map1.get(c); if (count == null) { map1.put(c, 1); } else { map1.put(c, count + 1); } } for (char c : s.toCharArray()) { Integer count = map1.get(c); if (count != null) { map1.put(c, count - 1); } } String result = "YES"; for (char c : map1.keySet()) { if (map1.get(c)>0) { result = "NO"; break; } } System.out.println(result); } } }