#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 200010;
#define int long long
struct node
{
int l, r;
int sum, add, clear;
}tr[N*4];
void pushup(int u)
{
tr[u].sum = tr[u<<1].sum + tr[u<<1|1].sum;
}
void eval(node &t,int add,int clear)
{
if(clear)
{
t.add = 0;
t.sum = 0;
t.clear = clear;
}
if(add)
{
t.add += add;
t.sum += (t.r - t.l + 1) * add;
}
}
void pushdown(int u)
{
eval(tr[u<<1], tr[u].add, tr[u].clear);
eval(tr[u<<1|1], tr[u].add, tr[u].clear);
tr[u].clear = 0;
tr[u].add = 0;
}
void build(int u,int l,int r)
{
if(l == r) tr[u] = {l, r, 0, 0, 0};
else
{
tr[u] = {l,r};
int mid = l + r >> 1;
build(u<<1, l, mid);
build(u<<1|1, mid+1, r);
pushup(u);
}
}
void modify(int u,int l,int r,int v,int clear)
{
if(tr[u].l >= l && tr[u].r <= r)
{
eval(tr[u], v, clear);
return ;
}
pushdown(u);
int mid = tr[u].l + tr[u].r >> 1;
if(l <= mid) modify(u<<1, l, r, v, clear);
if(r > mid) modify(u<<1|1, l, r, v, clear);
pushup(u);
}
int query(int u,int l,int r)
{
if(tr[u].l >= l && tr[u].r <= r)return tr[u].sum;
int res = 0;
int mid = tr[u].l + tr[u].r >> 1;
pushdown(u);
if(l <= mid) res += query(u<<1, l, r);
if(r > mid) res += query(u<<1|1, l, r);
return res;
}
void solve()
{
int n,m;
cin>>n>>m;
build(1,1,n);
int op,l,r,v;
while(m--)
{
cin>>op;
if(op==1)
{
cin>>l>>r>>v;
modify(1, l, r, v, 0);
}
else
{
cin >> v;
int l = 1, r = n;
while(l < r)
{
int mid = l + r >> 1;
if(query(1,1,mid) >= v) r = mid;
else l = mid + 1;
}
if(query(1,1,r)<v)cout<<"Trote_w is sb"<<'\n';
else
{
cout << r << '\n';
modify(1, r, r, -v+query(1,1,r-1), 0);
modify(1, 1, r-1, 0, 1);
}
}
}
}
signed main()
{
int T;cin>>T;
while(T--)solve();
}