#!/bin/python3

import sys

q = int(input().strip())
for a0 in range(q):
    s = input().strip()
    # your code goes here
    match=list('hackerrank')
    case=list(s)
    for i in range(len(match)):

        if match[i] in case and i==len(match)-1:
            print ('YES')
        elif i==len(match)-1:
            print ('NO')
    
        if match[i] in case:
            case.remove(match[i])
            continue
        elif match[i] not in match:
            print ('NO')