Squirrel Liss loves nuts. Liss asks you to plant some nut trees.

There are n positions (numbered 1 to n from west to east) to plant a tree along a street. Trees grow one meter per month. At the beginning of each month you should process one query. The query is one of the following types:

  1. Plant a tree of height h at position p. 
  2. Cut down the x-th existent (not cut) tree from the west (where x is 1-indexed). When we cut the tree it drops down and takes all the available place at the position where it has stood. So no tree can be planted at this position anymore. 



After processing each query, you should print the length of the longest increasing subsequence. A subset of existent trees is called an increasing subsequence if the height of the trees in the set is strictly increasing from west to east (for example, the westmost tree in the set must be the shortest in the set). The length of the increasing subsequence is the number of trees in it.

Note that Liss don't like the trees with the same heights, so it is guaranteed that at any time no two trees have the exactly same heights.

Input

The first line contains two integers: n and m (1 ≤ n ≤ 105; 1 ≤ m ≤ 2·105) — the number of positions and the number of queries.

Next m lines contains the information of queries by following formats:

  * If the i-th query is type 1, the i-th line contains three integers: 1, pi, and hi (1 ≤ pi ≤ n, 1 ≤ hi ≤ 10), where pi is the position of the new tree and hi is the initial height of the new tree. 
  * If the i-th query is type 2, the i-th line contains two integers: 2 and xi (1 ≤ xi ≤ 10), where the xi is the index of the tree we want to cut. 



The input is guaranteed to be correct, i.e.,

  * For type 1 queries, pi will be pairwise distinct. 
  * For type 2 queries, xi will be less than or equal to the current number of trees. 
  * At any time no two trees have the exactly same heights. 



In each line integers are separated by single spaces.

Output

Print m integers — the length of the longest increasing subsequence after each query. Separate the numbers by whitespaces.

Examples

Input

4 6
1 1 1
1 4 4
1 3 4
2 2
1 2 8
2 3


Output

1
2
3
2
2
2

Note

States of street after each query you can see on the following animation:

<image>

If your browser doesn't support animation png, please see the gif version here: http://212.193.37.254/codeforces/images/162/roadtree.gif
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3fll;
char __wzp[1 << 15 | 1], *__S = __wzp + 32768;
inline int read() {
  register int x = 0, dp = 1;
  register char c =
      (__S >= __wzp + 32768
       ? (__wzp[fread(__wzp, sizeof(char), 1 << 15, stdin)] = EOF),
       *((__S = __wzp)++) : *(__S++));
  for (; !isdigit(c);
       c = (__S >= __wzp + 32768
            ? (__wzp[fread(__wzp, sizeof(char), 1 << 15, stdin)] = EOF),
            *((__S = __wzp)++) : *(__S++)))
    if (c == '-') dp = -1;
  for (; isdigit(c);
       c = (__S >= __wzp + 32768
            ? (__wzp[fread(__wzp, sizeof(char), 1 << 15, stdin)] = EOF),
            *((__S = __wzp)++) : *(__S++)))
    x = (x << 1) + (x << 3) + (c ^ 48);
  return x * dp;
}
void write(int x) {
  if (x < 0) x = -x, putchar('-');
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(int x) {
  write(x);
  puts("");
}
const int maxn = 262144;
struct seg {
  int n, mx[maxn];
  int f[maxn];
  inline void modify(int x, int v) {
    for (mx[x += n] = v, x >>= 1; x; x >>= 1)
      mx[x] = mx[x << 1] < mx[x << 1 | 1] ? mx[x << 1 | 1] : mx[x << 1];
  }
  inline int query(int l, int r) {
    int ans = 0;
    for (l += n - 1, r += n + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {
      if (~l & 1)
        if (mx[l ^ 1] > ans) ans = mx[l ^ 1];
      if (r & 1)
        if (mx[r ^ 1] > ans) ans = mx[r ^ 1];
    }
    return ans;
  }
  inline void ins(int x) { modify(x, f[x] = query(1, x - 1) + 1); }
  void build(int _n) {
    for (n = 1; n < _n + 2; n <<= 1)
      ;
  }
} T0, T1;
int h[maxn], pos[maxn];
int n, m;
set<int> s;
set<int>::iterator it;
int ans;
signed main() {
  n = read(), m = read();
  T0.build(m + 10), T1.build(n);
  for (register int i = (1); i <= int(m); ++i) {
    if (read() == 1) {
      int k = n + 1 - read();
      h[k] = i + 10 - read();
      pos[h[k]] = k;
      s.insert(k);
      for (register int j = (h[k]); j <= int(h[k] + 9); ++j)
        if (pos[j]) {
          T1.modify(pos[j], 0);
        }
      for (register int j = (h[k]); j <= int(h[k] + 9); ++j)
        if (pos[j]) {
          T1.ins(pos[j]);
          T0.f[j] = T1.f[pos[j]];
          T0.modify(j, T0.f[j]);
        }
    } else {
      int k = read();
      for (it = s.end(); k; k--) {
        it--;
        T0.modify(h[*it], 0);
      }
      T1.modify(*it, 0);
      pos[h[*it]] = 0;
      for (s.erase(it++); it != s.end(); it++) {
        T0.ins(h[*it]);
        T1.f[*it] = T0.f[h[*it]];
        T1.modify(*it, T1.f[*it]);
      }
    }
    writeln(T0.mx[1]);
  }
  return 0;
}
