#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
int const maxn = 100 * 1000;
struct segment { int L,R,F; };
segment S[5*maxn];
/*
void show ( ostream & o, int l, int r, segment const & s )
{
o << "[" << l << " ," << r<< "]: {L= "
<< s.L << ", R= " << s.R << ", F= " << s.F << " }"
<< endl;
}
*/
int s,x,y;
int max5 (int a, int b, int c, int d, int e)
{
a=max(a,b); c=max(c,d); a=max(a,c); a=max(a,e);
return a;
}
void update ( int u, int l, int r )
{
if ( x <= l && r <= y )
{
S[u].L=S[u].R=S[u].F=(0==s)?0:(r-l+1);
// show (cout, l, r, S[u]);
}
else
{
int v=(2*u),w=1+v,m=(l+r)/2;
if ( 0 == S[u].F )
{
S[v].L=S[v].R=S[v].F=0;
S[w].L=S[w].R=S[w].F=0;
}
if ( (r-l+1) == S[u].F )
{
S[v].L=S[v].R=S[v].F=m-l+1;
S[w].L=S[w].R=S[w].F=r-m;
}
if ( m >= x ) update(v,l,m);
if ( 1+m <= y ) update(w,1+m,r);
S[u].L=S[v].L+(((m-l+1)==S[v].L)?S[w].L:0);
S[u].R=S[w].R+(((r-m)==S[w].R)?S[v].R:0);
S[u].F=max5(S[u].L,S[u].R,S[v].F,S[w].F,S[v].R+S[w].L);
// show (cout, l, r, S[u]);
}
}
void init (int u, int l, int r)
{
S[u].L=S[u].R=S[u].F=(r-l+1);
if ( l<r )
{
int v=(2*u), w=1+v, m=(l+r)/2;
init (v,l,m);
init (w,1+m,r);
}
}
#define MARK(V,A,B) s=V;x=A;y=B; update(1,1,n);
#define FMAX S[1].F
int
main ( ) {
ifstream is ("hotel.in");
ofstream os ("hotel.out");
int i,n,p,t,a,r;
is>>n>>p;
init (1,1,n);
for ( i=0; p>i; ++i )
{
is>>t;
if ( 3 == t )
{
os<<FMAX<<endl;
}
else
{
is>>a>>r;
/*
cout << "MARK " << t << " "
<< a << " " << a+r-1 << endl;
*/
MARK((2==t)?1:0,a,a+r-1);
}
}
return 0;
}