## Code:

#include<cmath>
#include<bitset>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>

#define ll long long
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))

const int N=1e5+2;
const int inf=1e9+9;

template <typename _Tp> inline void IN(_Tp&x){
char ch;bool flag=0;x=0;
while(ch=getchar(),!isdigit(ch))if(ch=='-')flag=1;
while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
if(flag)x=-x;
}

std::bitset<N> now1,now2;
int n,m,l,r,s,a[N],c[N],Be[N],ans[N];
struct MO{int opt,l,r,x,id;}q[N];

inline bool cmp(MO a,MO b)
{return Be[a.l]==Be[b.l]?a.r<b.r:a.l<b.l;}

inline void input(){
IN(n),IN(m);s=sqrt(n);
for(int i=1;i<=n;++i)IN(a[i]),Be[i]=(i-1)/s+1;
for(int i=1;i<=m;++i)
IN(q[i].opt),IN(q[i].l),IN(q[i].r),IN(q[i].x),q[i].id=i;
std::sort(q+1,q+1+m,cmp);
l=1,r=0;now1.reset(),now2.reset();
}

inline void Add(int x){if(c[x]++==0)now1[x]=1,now2[N-x]=1;}
inline void Del(int x){if(--c[x]==0)now1[x]=0,now2[N-x]=0;}

int main(){
input();
for(int i=1;i<=m;++i){
while(l<q[i].l)Del(a[l++]);
while(r>q[i].r)Del(a[r--]);
if(q[i].opt==1){
if((now1&(now1<<q[i].x)).any())ans[q[i].id]=true;
}else if(q[i].opt==2){
if((now1&(now2>>(N-q[i].x))).any())ans[q[i].id]=true;
}else if(q[i].opt==3){
for(int j=1;j*j<=q[i].x;++j)
if(!(q[i].x%j)&&now1[j]&&now1[q[i].x/j])
{ans[q[i].id]=true;break;}
}
}
for(int i=1;i<=m;++i)
if(ans[i])printf("hana\n");
else printf("bi\n");
return 0;
}

QAQ