#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 9,M = 1e5 + 9,SqrtN = 339,V = 1 << 20;
int n,m;
struct block{
int l,r;
} b[SqrtN];
int belong[N];
int block_len,block_cnt;
void build_block(){
block_len = block_cnt = (int)sqrt(n);
for(int i = 1;i <= block_cnt;i++){
b[i].l = b[i - 1].r + 1;
b[i].r = i * block_len;
}
b[block_cnt].r = n;
for(int i = 1;i <= block_cnt;i++)
for(int j = b[i].l;j <= b[i].r;j++)
belong[j] = i;
}
struct queries{
int typ,l,r,x;
int id;
} q[M];
int a[N],max_a;
int cnt[V];
bitset<V> vis1,vis2;
bool ans[M];
int lres = 1,rres;
bool cmp(queries q1,queries q2){
return belong[q1.l] == belong[q2.l] ? belong[q1.r] < belong[q2.r] : belong[q1.l] < belong[q2.l];
}
void add(int x){
cnt[x]++;
if(cnt[x] == 1)
vis1[x] = vis2[max_a - x] = true;
}
void del(int x){
cnt[x]--;
if(cnt[x] == 0)
vis1[x] = vis2[max_a - x] = false;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin >> n >> m;
build_block();
for(int i = 1;i <= n;i++){
cin >> a[i];
max_a = max(max_a,a[i]);
}
max_a <<= 1;
for(int i = 1;i <= m;i++){
cin >> q[i].typ >> q[i].l >> q[i].r >> q[i].x;
q[i].id = i;
}
sort(q + 1,q + m + 1,cmp);
for(int i = 1;i <= m;i++){
int L = q[i].l,R = q[i].r;
while(lres > L)
add(a[--lres]);
while(rres < R)
add(a[++rres]);
while(lres < L)
del(a[lres++]);
while(rres > R)
del(a[rres--]);
if(q[i].typ == 1)
if((vis1 & (vis1 >> q[i].x)).any())
ans[q[i].id] = true;
else if(q[i].typ == 2)
if((vis1 & (vis2 >> (max_a - q[i].x))).any())
ans[q[i].id] = true;
else if(q[i].typ == 3)
for(int j = 1;j * j <= q[i].x;j++)
if(vis1[j] && vis1[q[i].x / j] && !(q[i].x % j)){
ans[q[i].id] = true;
break;
}
}
for(int i = 1;i <= m;i++)
cout << (ans[i] ? "hana" : "bi") << '\n';
return 0;
}