process.stdin.resume(); process.stdin.setEncoding('ascii'); var input_stdin = ""; var input_stdin_array = ""; var input_currentline = 0; process.stdin.on('data', function (data) { input_stdin += data; }); process.stdin.on('end', function () { input_stdin_array = input_stdin.split("\n"); main(); }); function readLine() { return input_stdin_array[input_currentline++]; } /////////////// ignore above this line //////////////////// function main() { var q = parseInt(readLine()); for(var a0 = 0; a0 < q; a0++){ var s = readLine(); // your code goes here var letter = 0; var i = -1; while (letter === 0 && i <= s.length) { i++; if (s[i] === "h") { letter++; } } while (letter === 1 && i <= s.length) { i++; if (s[i] === "a") { letter++; } } while (letter === 2 && i <= s.length) { i++; if (s[i] === "c") { letter++; } } while (letter === 3 && i <= s.length) { i++; if (s[i] === "k") { letter++; } } while (letter === 4 && i <= s.length) { i++; if (s[i] === "e") { letter++; } } while (letter === 5 && i <= s.length) { i++; if (s[i] === "r") { letter++; } } while (letter === 6 && i <= s.length) { i++; if (s[i] === "r") { letter++; } } while (letter === 7 && i <= s.length) { i++; if (s[i] === "a") { letter++; } } while (letter === 8 && i <= s.length) { i++; if (s[i] === "n") { letter++; } } while (letter === 9 && i <= s.length) { i++; if (s[i] === "k") { letter++; } } if (letter === 10) { console.log("YES"); } else { console.log("NO"); } letter = 0; i=0; } }