#include <bits/stdc++.h>
using namespace std;
const int N = int(3e5) + 11l;
int n, m;
int l[N], r[N], k[N];
int t[N * 8];
int p[N * 8];
vector<int> unzip;
int get(int v, int l, int r) {
  if (p[v] == 1) return unzip[r] - unzip[l];
  if (p[v] == 2) return 0;
  return t[v];
}
void push(int v, int l, int r) {
  if (p[v] == 0) return;
  int m = (l + r) / 2;
  p[v * 2 + 1] = p[v * 2 + 2] = p[v];
  t[v] = get(v * 2 + 1, l, m) + get(v * 2 + 2, m, r);
  p[v] = 0;
}
void update(int v, int l, int r, int lq, int rq, int k) {
  if (l >= r || lq >= rq) return;
  if (l == lq && r == rq) {
    p[v] = k;
    return;
  }
  int m = (l + r) / 2;
  push(v, l, r);
  update(v * 2 + 1, l, m, lq, min(rq, m), k);
  update(v * 2 + 2, m, r, max(lq, m), rq, k);
  t[v] = get(v * 2 + 1, l, m) + get(v * 2 + 2, m, r);
}
int zip(int x) {
  return lower_bound(unzip.begin(), unzip.end(), x) - unzip.begin();
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", l + i, r + i, k + i);
    l[i]--;
    unzip.push_back(l[i]);
    unzip.push_back(r[i]);
  }
  sort(unzip.begin(), unzip.end());
  for (int i = 0; i < m; i++) {
    update(0, 0, unzip.size(), zip(l[i]), zip(r[i]), k[i]);
    printf("%d\n", n - get(0, 0, unzip.size()));
  }
  return 0;
}
