#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
    int q; 
    int i;
    int j;
    char *hack = "hackerrank";
    scanf("%d",&q);
    for(int a0 = 0; a0 < q; a0++){
        char* s = (char *)malloc(512000 * sizeof(char));
        scanf("%s",s);
        // your code goes here
        i = 0;
        j = 0;
        while (s[i])
            {
            if (s[i] == hack[j])
                j++;
            i++;
        }
        if (j == 10)
            printf("%s\n", "YES");
        else
            printf("%s\n", "NO");
    }
    
    return 0;
}