text: #!/bin/python3
  
  import math
  import os
  import random
  import re
  import sys
  
  #
  # Complete the 'hackerrankInString' function below.
  #
  # The function is expected to return a STRING.
  # The function accepts STRING s as parameter.
  #
  
  def hackerrankInString(s):
      s = list(s)
      h = list("hackerrank ")
      
      k = 0
      for i in range(len(s)):
          if s[i] == h[k]:
              k += 1
              
      if k == 10:
          return "YES"
      else:
          return "NO"
          
  
  if __name__ == '__main__':
      fptr = open(os.environ['OUTPUT_PATH'], 'w')
  
      q = int(input().strip())
  
      for q_itr in range(q):
          s = input()
  
          result = hackerrankInString(s)
  
          fptr.write(result + '\n')
  
      fptr.close()
  