#include using namespace std; #define ll long long #define pb push_back int main() { int q; cin >> q; for (int i = 1; i <= q; i++) { string s; cin >> s; char lst = '!'; bool bb = 0; for (int j = 0; j < s.size(); j++) { if (s[j] == 'h' && lst == '!') { lst = 'h'; continue; } if (s[j] == 'a' && lst == 'h') { lst = 'a'; continue; } if (s[j] == 'c' && lst == 'a') { lst = 'c'; continue; } if (s[j] == 'k' && lst == 'c') { lst = 'k'; continue; } if (s[j] == 'e' && lst == 'k') { lst = 'e'; continue; } if (s[j] == 'r' && lst == 'e') { lst = 'r'; continue; } if (s[j] == 'r' && lst == 'r') { lst = 'R'; continue; } if (s[j] == 'a' && lst == 'R') { lst = 'A'; continue; } if (s[j] == 'n' && lst == 'A') { lst = 'n'; continue; } if (s[j] == 'k' && lst == 'n') { bb = 1; break; } } if (bb) cout << "YES" << endl; else cout << "NO" << endl; } }