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 t = in.nextInt(); String lookForStr = "hackerrank"; char []lookFor = lookForStr.toCharArray(); int lookForInd = 0; for (int t_i = 0; t_i < t; t_i++) { String s = in.next(); lookForInd = 0; for (int i = 0; i < s.length(); i++) { if (lookForInd == lookForStr.length() - 1) { break; } if (s.charAt(i) == lookFor[lookForInd]) { lookForInd++; } } if (lookForInd == lookForStr.length() - 1) { System.out.println("YES"); } else { System.out.println("NO"); } } } }