#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool upmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool upmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const long double eps = 1e-11;
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long loo = 1ll << 62;
const int mods = 998244353;
const int MAXN = 200055;
const int INF = 0x3f3f3f3f;
inline int read() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
priority_queue<int> que;
int h[MAXN], hid[MAXN], p[20];
struct Segment_Tree {
  int mx[MAXN << 2];
  void up(int x) { mx[x] = max(mx[x << 1], mx[x << 1 | 1]); }
  void change(int x, int l, int r, int y, int z) {
    if (l == r) {
      mx[x] = z;
      return;
    }
    int mid = (l + r) >> 1;
    if (y <= mid)
      change(x << 1, l, mid, y, z);
    else
      change(x << 1 | 1, mid + 1, r, y, z);
    up(x);
  }
  int query(int x, int l, int r, int L, int R) {
    if (l >= L && r <= R) return mx[x];
    int mid = (l + r) >> 1;
    if (R <= mid)
      return query(x << 1, l, mid, L, R);
    else if (L > mid)
      return query(x << 1 | 1, mid + 1, r, L, R);
    else
      return max(query(x << 1, l, mid, L, mid),
                 query(x << 1 | 1, mid + 1, r, mid + 1, R));
  }
} idtree, htree;
int main() {
  int n = read(), m = read();
  for (int Case = 1; Case <= m; Case++) {
    int opt = read(), x, y;
    if (opt == 1) {
      x = read(), y = read() - Case + m;
      h[x] = y, hid[y] = x, que.push(-x);
      for (int i = y; i >= max(1, y - 9); i--)
        if (hid[i])
          idtree.change(1, 1, n, hid[i], 0), htree.change(1, 1, m + 10, i, 0);
      for (int i = y; i >= max(1, y - 9); i--)
        if (hid[i]) {
          int t = idtree.query(1, 1, n, hid[i], n) + 1;
          idtree.change(1, 1, n, hid[i], t);
          htree.change(1, 1, m + 10, i, t);
        }
    } else if (opt == 2) {
      x = read();
      for (int i = 1; i <= x; i++) p[i] = -que.top(), que.pop();
      for (int i = 1; i < x; i++) que.push(-p[i]);
      for (int i = x; i >= 1; i--)
        idtree.change(1, 1, n, p[i], 0), htree.change(1, 1, m + 10, h[p[i]], 0);
      for (int i = x - 1; i >= 1; i--) {
        int t = htree.query(1, 1, m + 10, h[p[i]], m + 10) + 1;
        idtree.change(1, 1, n, p[i], t);
        htree.change(1, 1, m + 10, h[p[i]], t);
      }
      hid[h[p[x]]] = 0, h[p[x]] = 0;
    }
    printf("%d\n", idtree.mx[1]);
  }
  return 0;
}
