#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int N6 = 1e6 + 6; const int N9 = 1e9 + 7; typedef unsigned long long ull; typedef long long ll; typedef double ld; typedef pair PII; typedef pair PIl; typedef pair PlI; typedef pair Pll; #define F first #define S second #define pb push_back #define p push #define mp make_pair #define re(x, a) for (__typeof(a) x = 1; x <= a; ++x) #define reo(x, a) for (__typeof(a) x = 1; x <= a; ++x) #define rep(x, a) for (__typeof(a) x = 1; x <= a; ++x) #define erp(x, a) for (__typeof(a) x = 1; x <= a; ++x) #define repp(x, a) for (__typeof(a) x = 0; x < a; ++x) #define epo(x, a) for (__typeof(a) x = 1; x <= a; ++x) #define itn int #define for1(x, a, b) for (int x = b; x >= a; --x) #define sz(x) (int)x.size() #define siz size #define skip continue #define gg exit(0) #define boost ios_base::sync_with_stdio(0),cin.tie(NULL) #define task "a" const ll N = 1e5 + 200; const int INF = (int)1e9 + 100; const ll mod = 1e9 + 7; const ll BLOCK = 316; int q; int main(){ // #ifndef ONLINE_JUDGE // #endif boost; cin >> q; string s; for(int i = 1; i <= q; ++i){ cin >> s; bool h = 0, a = 0, c = 0, k = 0, e = 0, r1 = 0, r = 0, a1 = 0, n = 0, k1 = 0; for(int j = 0; j < s.siz(); ++j){ if( !h && s[j] == 'h' )h = 1; else if( h && !a && s[j] == 'a' )a = 1; else if( a && h && !c && s[j] == 'c' )c = 1; else if( a && h && c && !k && s[j] == 'k' )k = 1; else if( a && h && c && k && !e && s[j] == 'e' )e = 1; else if( a && h && c && k && e && !r1 && s[j] == 'r' )r1 = 1; else if( a && h && c && k && r1 && e && !r && s[j] == 'r' )r = 1; else if( a && h && c && k && r && r1 && e && !a1 && s[j] == 'a' )a1 = 1; else if( a && h && c && k && r && r1 && a1 && e && !n && s[j] == 'n' )n = 1; else if( a && h && c && k && r && r1 && a1 && n && e && !k1 && s[j] == 'k' )k1 = 1; } if( a && h && c && k && r && r1 && a1 && n && e && k1 )cout << "YES\n"; else cout << "NO\n"; } return 0; }