#include <iostream> 
#include <cmath>
#include <set>
#include <algorithm>
#include <vector>
#include <string>
#include <limits>
#include <sstream>
#include <queue>
// #include <pair>
#include <stack>
#include <cstdio>
#include <map>
#include <bitset>
#include <iomanip> 
using namespace std;

// const ll maxNum = 100000000;
 typedef long long ll;
 typedef vector<int> vi;
#define MAX 1000000007
#define Mod 1234567891

#define gc getchar_unlocked
void scanint(int &x)
{
    register int c = gc();
    x = 0;
    bool neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
void scanll(ll &x)
{
    register ll c = gc();
    x = 0;
    bool neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}


// ll power(ll base, ll exp , ll mod) {
//     ll res=1;
//     while(exp>0) {
//        if(exp%2==1) res=(res*base)%mod;
//        base=(base*base)%mod;
//        exp/=2;
//     }
//     return res;
// }

struct ele
{
  ll a,b;
};

bool comp(ele &a, ele &b)
{
  //if(a.a==b.a) return a.b < b.b;
  return a.a < b.a;
}

ll gcd(ll a,ll b)
{
  if(b==0) return a;
  return gcd(b,a%b);
}

vector<ll> dp1(1,-1);

ll ans1(string& s,int st,vector<ll>& a)
{
  if(dp1[st]!=-1) return dp1[st];
  //vector<ll> b(26,0);
  int i;
  ll len = (s.size()-st);
  ll ans=0;
  for(i=st;i<s.size() and i<st+len;i++)
  {
    len = min(len,a[s[i]-'a']);
    if(i-st+1<=len)
    {
      ll x = ans1(s,i+1,a);
      ans = (ans+x)%MAX;
    }
  }
  dp1[st] = ans;
  return ans;
}

ll ans2(string& s,vector<ll>& a)
{
  ll len = s.size();
  ll i=0,j=0;
  ll maxi = 0;
  ll mini = s.size();
  while(j<len)
  {
    if(a[s[j]-'a']>=(j-i+1)) j++;
    else
    {
      maxi = max(maxi,j-i);
      i = j-a[s[j]-'a']+1;
      j++;
    }
  }
  maxi = max(maxi,j-i);
  return maxi;
}

ll ans3(string& s,int st,vector<ll>& a)
{
  if(st==s.size()) return 0;
  //vector<ll> b(26,0);
  ll i;
  ll len = (s.size()-st);
  ll ans=0;
  for(i=st;i<s.size() and i<st+len;i++)
  {
    len = min(len,a[s[i]-'a']);
    if(i-st+1>len) break;
  }
  return 1+ans3(s,i,a);
}

void solve()
{     
  string s,a="hackerrank";
  cin>>s;
  int toSearch=0;
  int i=0;
  while(i<s.size() and toSearch<a.size())
  {
    int x = s.find(a[toSearch],i);
    if(x==string::npos)
    {
      cout<<"NO\n";
      return;
    }
    toSearch++;
    i = x+1;
  }
  if(toSearch==a.size()) cout<<"YES\n";
  else cout<<"NO\n";
}

int main()
{
  ll t;
 //cin>>t;
 scanll(t);
 for(ll i=1;i<=t;i++) solve();
}