#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <stdio.h>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <queue>
# include <unordered_map>
using namespace std;


#define all(v) (v).begin(),(v).end()
#define sz(a) int((a).size())
#define PB push_back
#define mem(a, b) memset(a, b, sizeof(a))
#define MP make_pair
#define EPS      1e-9
#define oo       1e9
#define OO       1e14*1LL
#define PI       3.141592653589793
#define F        first
#define S        second
#define pw(x)	 (x)*(x)

typedef stringstream ss;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
const int dx[] = { 0, -1, 0, 1, -1, -1, 1, 1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, 1, -1 };

int main()
{
	string str; int T; cin >> T;
	char arr[] = { 'h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k' };
	while (T) {
		int k = 0, cnt = 0; cin >> str;
		for (int i = 0; i < sz(str); i++) {
			if (str[i] == arr[k]) {
				cnt++; k++;
			}
		}
		if (cnt == 10)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
		T--;
	}
	return 0;
}