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(); List baseStr = new ArrayList(); Queue str = new LinkedList(); String sa = "hackerrank"; for(char temp: sa.toCharArray()) baseStr.add(temp); for(char temp: s.toCharArray() ) str.add(temp); int wordlen = str.size(); int count = 0; while(wordlen-- > 0) { char a = (char)str.remove(); if(baseStr.get(count)==a) { count++; } } if(count == 10) System.out.println("YES"); else System.out.println("NO"); } } }