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(); boolean check = check(s); if(check) { System.out.println("YES"); } else{ System.out.println("NO"); } } } public static boolean check(String s){ String base = "hackerrank"; boolean weDone = false; int index = 0; for(int i = 0; i < base.length(); i++) { char check = base.charAt(i); int size = s.length(); for(int j = index; j < size; j++) { char toCheck = s.charAt(j); if(check == toCheck){ index = j; if(toCheck == 'k' && j == size-1) { weDone = true; } } } } return weDone; } }