#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; 
    scanf("%d",&q);
    for(int a0 = 0; a0 < q; a0++){
        char* s = (char *)malloc(512000 * sizeof(char));
        scanf("%s",s);
        char str[] = "hackerrank";
        int j=0,i=0,flag = 0;
        while(*(str+j) != '\0'){
            if(*(s+i)==*(str+j)){
                i++;
                j++;
                continue;
            }
            else if(*(s+i) == '\0'){
                break;
            }
            else{
                i++;
                continue;
            }
            
        }
        if(*(str+j)!='\0')
            printf("NO\n");
        else if(*(s+i)!='\0')
            printf("NO\n");
            else
            printf("YES\n");
        // your code goes here
    }
    return 0;
}