#include <bits/stdc++.h>
using namespace std;
struct nr {
int lazy,st,dr,val;
}pom[300000];
int n,m,t;
void update(int nod, int st, int dr, int x, int y, int val) {
if(st > dr)
return;
int md = (st + dr) / 2;
if(st >= x && dr <= y) {
if(val == -1)
pom[nod].st = pom[nod].dr = pom[nod].val = 0;
else
pom[nod].st = pom[nod].dr = pom[nod].val = dr - st + 1;
pom[nod].lazy = val;
return;
}
if(pom[nod].lazy != 0) {
update(2 * nod, st, md, st, md, pom[nod].lazy);
update(2 * nod + 1, md + 1, dr, md + 1, dr, pom[nod].lazy);
pom[nod].lazy = 0;
}
if(x <= md)
update(2 * nod, st, md, x, y, val);
if(y > md)
update(2 * nod + 1, md + 1, dr, x, y, val);
pom[nod].val = max(pom[2 * nod].val, max(pom[2 * nod + 1].val, pom[2 * nod].dr + pom[2 * nod + 1].st));
pom[nod].st = pom[2 * nod].st;
if(pom[2 * nod].val == (md - st + 1))
pom[nod].st += pom[2 * nod + 1].st;
pom[nod].dr = pom[2 * nod + 1].dr;
if(pom[2 * nod + 1].val == (dr - md))
pom[nod].dr += pom[2 * nod].dr;
}
int main () {
ifstream fin("hotel.in");
ofstream fout("hotel.out");
int x,y;
fin >> n >> m;
for(int i = 1;i <= n;i++)
update(1, 1, n, i, i, 1);
for(int i = 1;i <= m;i++) {
fin >> t;
if(t == 1) {
fin >> x >> y;
update(1, 1, n, x, x + y - 1, -1);
}
else if(t == 2) {
fin >> x >> y;
update(1, 1, n, x, x + y - 1, 1);
}
else if(t == 3)
fout << pom[1].val << '\n';
}
return 0;
}