#include <fstream>
using namespace std;
const int N = 1 + (1<<18);
ifstream in("hotel.in");
ofstream out("hotel.out");
struct nod
{
int st,dr,max;
};
int n,a,b;
nod t[N];
inline int fs(int p)
{
return p<<1;
}
inline int fd(int p)
{
return (p<<1) + 1;
}
inline int mijloc(int st, int dr)
{
return (st + dr) >> 1;
}
void init(int p, int st, int dr)
{
t[p].st = t[p].dr = t[p].max = dr - st + 1;
if(st == dr)
return;
int mij = (st + dr) >> 1;
if(a <= mij)
init(fs(p), st, mij);
if(a > mij)
init(fd(p), mij+1, dr);
}
inline void zero(int p)
{
t[p].st = t[p].dr = t[p].max = 0;
}
inline void complet(int p, int st, int dr)
{
t[p].st = t[p].dr = t[p].max = dr - st + 1;
}
inline bool plin(int p, int st, int dr)
{
return t[p].max == dr - st + 1;
}
inline bool gol(int p)
{
return t[p].max == 0;
}
inline void actualizare(int p, int st, int dr, int fs, int fd)
{
if(t[fs].st == mijloc(st, dr) - st + 1)
t[p].st = t[fs].st + t[fd].st;
else
t[p].st = t[fs].st;
if(t[fd].dr == dr - mijloc(st, dr))
t[p].dr = t[fd].dr + t[fs].dr;
else
t[p].dr = t[fd].dr;
t[p].max = max(max(t[fs].max, t[fd].max), t[fs].dr + t[fd].st);
}
void modifica(int tip, int p, int st, int dr)
{
if(st == dr)
{
if(tip == 1)
zero(p);
else
complet(p, st, dr);
return;
}
int mij = mijloc(st, dr);
if(plin(p, st, dr))
{
complet(fs(p), st, mij);
complet(fd(p), mij+1, dr);
}
if(gol(p))
{
zero(fs(p));
zero(fd(p));
}
if(a <= mij)
modifica(tip, fs(p), st, mij);
if(b > mij)
modifica(tip, fd(p), mij+1, dr);
actualizare(p, st, dr, fs(p), fd(p));
}
int main()
{
int m,tip,nr;
in>>n>>m;
for(int i=1 ; i<=n ; i++)
{
a = i;
init(1, 1, n);
}
while(m--)
{
in>>tip;
if(tip == 1 || tip == 2)
{
in>>a>>nr;
b = a + nr - 1;
modifica(tip, 1, 1, n);
continue;
}
out<<t[1].max<<"\n";
}
return 0;
}