#include <fstream>
#include <queue>
#include <unordered_map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
ifstream fin ("hotel.in");
ofstream fout("hotel.out");
int n,t,i,C;
struct elem
{
int val,st,dr,flag;
}A[500003];
elem U(elem st,elem dr)
{
elem a={0,0,0,0};
a.st=st.st;
a.dr=dr.dr;
if(st.val&&st.st==st.val)
a.st+=dr.st;
if(dr.val&&dr.dr==dr.val)
a.dr+=st.dr;
a.val=max(st.dr+dr.st,max(a.st,a.dr));
return a;
}
void build(int nod,int st,int dr)
{
if(st==dr)
A[nod]={1,1,1,0};
else
{
int mid=(st+dr)/2;
build(2*nod,st,mid);
build(2*nod+1,mid+1,dr);
A[nod]=U(A[2*nod],A[2*nod+1]);
}
}
void update(int nod,int st,int dr,int a,int b,bool val)
{
if(a<=st&&dr<=b)
{
if(!val)
A[nod]={dr-st+1,dr-st+1,dr-st+1,2};
else
A[nod]={0,0,0,1};
}
else
{
int mid=(st+dr)/2;
if(A[nod].flag)
{
//fout<<nod<<"DAAAA\n";
if(A[nod].flag==1)
{
A[2*nod]={0,0,0,1};
A[2*nod+1]={0,0,0,1};
}
else
{
A[2*nod]={mid-st+1,mid-st+1,mid-st+1,2};
A[2*nod+1]={dr-mid,dr-mid,dr-mid,2};
}
A[nod].flag=0;
}
if(a<=mid)
update(2*nod,st,mid,a,b,val);
if(mid+1<=b)
update(2*nod+1,mid+1,dr,a,b,val);
//fout<<st<<" "<<mid<<" "<<dr<<"\n";
//fout<<A[2*nod].st<<" "<<A[2*nod].dr<<" "<<A[2*nod+1].st<<" "<<A[2*nod+1].dr<<"\n";
A[nod]=U(A[2*nod],A[2*nod+1]);
//fout<<A[nod].val<<" "<<A[nod].st<<" "<<A[nod].dr<<"DA\n";
}
}
void op1()
{
int st,m;
fin>>st>>m;
update(1,1,n,st,st+m-1,1);
//fout<<A[1].val<<"\n";
}
void op2()
{
int st,m;
fin>>st>>m;
update(1,1,n,st,st+m-1,0);
}
void op3()
{
fout<<A[1].val<<"\n";
}
int main()
{
fin>>n>>t;
build(1,1,n);
while(t--)
{
fin>>C;
if(C==1)
{
op1();
continue;
}
if(C==2)
{
op2();
continue;
}
op3();
}
return 0;
}