#!/bin/python3 q = int(input().strip()) for a0 in range(q): s = input().strip() # string word = 'hackerrank' for item in s: if len(word) != 0: if item == word[0]: word = word[1:] if len(word) == 0: print ('YES') else: print ('NO')