#include <fstream>
using namespace std;
const int N=100001;
struct nod{int S,D,C;} v[3*N];
int n;
ifstream in("hotel.in");
ofstream out("hotel.out");
inline int max(int a,int b)
{
return a>b ? a : b;
}
inline void atrib(nod A,int x)
{
A.S=A.D=A.C=x;
}
void nod_update(int poz,int st,int dr)
{
if (poz>2*n)
return;
int m=(st+dr)>>1,S=poz<<1,D=(poz<<1)+1;
v[poz].S=v[S].S;
if (v[S].S==m-st+1)
v[poz].S+=v[D].S;
v[poz].D=v[D].D;
if (v[D].D==dr-m)
v[poz].D+=v[S].D;
v[poz].C=max(max(v[poz].S,v[poz].D),max(v[S].C,v[D].C));
v[poz].C=max(v[poz].C,v[S].D+v[D].S);
}
void update(int poz,int st,int dr,int x,int y,int val)
{
if (!poz)
return;
if (x<=st && y>=dr)
{
if (!val)
v[poz].S=v[poz].D=v[poz].C=dr-st+1;
else
v[poz].S=v[poz].D=v[poz].C=0;
return;
}
int m=(st+dr)>>1,S=poz<<1,D=(poz<<1)+1;
if (poz>2*n)
S=D=0;
if (!v[poz].C)
{
atrib(v[S],0);
atrib(v[D],0);
}
if (v[poz].C==dr-st+1)
{
atrib(v[S],m-st+1);
atrib(v[D],dr-m);
}
if (x<=m)
update(S,st,m,x,y,val);
if (m<y)
update(D,m+1,dr,x,y,val);
nod_update(poz,st,dr);
}
int main()
{
int t,i,x,y;
in>>n>>t;
for (i=1;i<=n;i++)
update(1,1,n,i,i,0);
while (t--)
{
in>>x;
if (x==1)
{
in>>x>>y;
y+=x-1;
update(1,1,n,x,y,1);
continue;
}
if (x==2)
{
in>>x>>y;
y+=x-1;
update(1,1,n,x,y,0);
continue;
}
out<<v[1].C<<"\n";
}
return 0;
}