#include <stdio.h>
#define Nmax 100003*4+66
int Lc[Nmax],Ls[Nmax],Ld[Nmax];
int n,p,i,m,op,max;
inline int Maxim(int x, int y){
return x>y ? x:y;
}
void Update(int nod, int l, int r, int x, int y, int val){
int m;
if( x<=l && r<=y ){
if(val==1) Lc[nod]=Ls[nod]=Ld[nod]=0;
else Lc[nod]=Ld[nod]=Ls[nod]=r-l+1;
return;
}
m=l+(r-l)/2;
if( Lc[nod] == r-l+1 ){
Lc[2*nod]=Ls[2*nod]=Ld[2*nod]=m-l+1;
Lc[2*nod+1]=Ls[2*nod+1]=Ld[2*nod+1]=r-m;
}else
if( Lc[nod] == 0 ){
Lc[2*nod]=Ls[2*nod]=Ld[2*nod]=0;
Lc[2*nod+1]=Ls[2*nod+1]=Ld[2*nod+1]=0;
}
if(x <= m) Update(2*nod,l,m,x,y,val);
if(m < y ) Update(2*nod+1,m+1,r,x,y,val);
if( Ls[2*nod]==m-l+1 ) Ls[nod]=Ls[2*nod]+Ls[2*nod+1];
else Ls[nod]=Ls[2*nod];
if( Ld[2*nod+1]==r-m ) Ld[nod]=Ld[2*nod+1]+Ld[2*nod];
else Ld[nod]=Ld[2*nod+1];
Lc[nod] = Maxim(Lc[2*nod] , Lc[2*nod+1]);
Lc[nod] = Maxim(Lc[nod], Ld[2*nod]+Ls[2*nod+1]);
}
int main(){
freopen("hotel.in","r",stdin);
freopen("hotel.out","w",stdout);
scanf("%d%d",&n,&p);
Update(1,1,n,1,n,0);
for(; p; --p){
scanf("%d",&op);
if(op<3){
scanf("%d%d",&i,&m);
if(op==1) Update(1,1,n,i,i+m-1,1);
else Update(1,1,n,i,i+m-1,2);
}
else{
max=Lc[1];
printf("%d\n",max);
}
}
fclose(stdin); fclose(stdout);
return 0;
}