#!/bin/python3 import sys def is_subsequence_of(str, word): cur_word_ind = 0 for let in str: if let == word[cur_word_ind]: if cur_word_ind == len(word) - 1: return True else: cur_word_ind += 1 return False q = int(input().strip()) for a0 in range(q): s = input().strip() # your code goes here if is_subsequence_of(s, 'hackerrank'): print('YES') else: print('NO')