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 h= "hackerrank"; boolean flag =false; char sArray[] = h.toCharArray(); Scanner in = new Scanner(System.in); int q = in.nextInt(); for(int a0 = 0; a0 < q; a0++){ String s = in.next(); for(char c : sArray) { String ts =Character.toString(c); if(s.contains(ts)) { if(c=='a' || c=='k' || c=='r') { if(s.indexOf(ts) != s.lastIndexOf(ts)) { flag =true; } else{ flag =false; } } } else{ System.out.println("NO"); break; } } if(flag) { System.out.println("YES"); } } } }