#include <bits/stdc++.h>
#define DIM 100010
using namespace std;
struct segment_tree{
int pref,suf,best,lazy;
} aint[DIM*4];
int n,q,tip,x,y;
void update_nod (int nod, int st, int dr){
int fiu_st = nod<<1, fiu_dr = (nod<<1)|1, mid = (st+dr)>>1;
aint[nod].best = max (aint[fiu_st].best, aint[fiu_dr].best);
aint[nod].best = max (aint[nod].best, aint[fiu_st].suf + aint[fiu_dr].pref);
aint[nod].suf = aint[fiu_dr].suf;
if (aint[fiu_dr].suf == dr-mid)
aint[nod].suf = dr - mid + aint[fiu_st].suf;
aint[nod].pref = aint[fiu_st].pref;
if (aint[fiu_st].pref == mid-st+1)
aint[nod].pref = mid - st + 1 + aint[fiu_dr].pref;
}
void update_lazy (int nod, int st, int dr){
if (!aint[nod].lazy)
return;
if (st != dr){
int fiu_st = nod<<1, fiu_dr = (nod<<1)|1, mid = (st+dr)>>1;
if (aint[nod].lazy == 1){
aint[fiu_st].pref = aint[fiu_st].suf = aint[fiu_st].best = 0;
aint[fiu_dr].pref = aint[fiu_dr].suf = aint[fiu_dr].best = 0;
} else {
aint[fiu_st].pref = aint[fiu_st].suf = aint[fiu_st].best = mid-st+1;
aint[fiu_dr].pref = aint[fiu_dr].suf = aint[fiu_dr].best = dr-mid;
}
aint[fiu_st].lazy = aint[nod].lazy;
aint[fiu_dr].lazy = aint[nod].lazy;
}
aint[nod].lazy = 0;
}
void update (int nod, int st, int dr, int x, int y, int val){
update_lazy (nod,st,dr);
if (x <= st && dr <= y){
if (val == 1){
aint[nod].pref = aint[nod].suf = aint[nod].best = 0;
aint[nod].lazy = 1;
} else {
aint[nod].pref = aint[nod].suf = aint[nod].best = dr-st+1;
aint[nod].lazy = 2;
}
update_lazy (nod,st,dr);
return;
}
int mid = (st+dr)>>1;
if (x <= mid)
update (nod<<1,st,mid,x,y,val);
if (y > mid)
update ((nod<<1)|1,mid+1,dr,x,y,val);
update_lazy (nod<<1,st,mid);
update_lazy ((nod<<1)|1,mid+1,dr);
update_nod (nod,st,dr);
}
void build (int nod, int st, int dr){
if (st == dr){
aint[nod].pref = aint[nod].suf = aint[nod].best = 1;
return;
}
int mid = (st+dr)>>1;
build (nod<<1,st,mid);
build ((nod<<1)|1,mid+1,dr);
update_nod (nod,st,dr);
}
int main (){
ifstream cin ("hotel.in");
ofstream cout ("hotel.out");
cin>>n>>q;
build (1,1,n);
for (;q--;){
cin>>tip;
if (tip == 1){
cin>>x>>y;
update (1,1,n,x,x+y-1,1);
continue;
}
if (tip == 2){
cin>>x>>y;
update (1,1,n,x,x+y-1,2);
continue;
}
cout<<aint[1].best<<"\n";
}
return 0;
}