#include <bits/stdc++.h>
using namespace std;
const int N = 16000000;
int tag[N], sum[N], c[N][2];
int P, n, Q, l, r, k, root;
void down(int x, int l, int r) {
  if (tag[x] == -1) return;
  int o = (l + r) >> 1;
  if (!c[x][0]) c[x][0] = ++P;
  tag[c[x][0]] = tag[x];
  sum[c[x][0]] = tag[x] * (o - l + 1);
  if (!c[x][1]) c[x][1] = ++P;
  tag[c[x][1]] = tag[x];
  sum[c[x][1]] = tag[x] * (r - o);
  tag[x] = -1;
}
void up(int x) { sum[x] = sum[c[x][0]] + sum[c[x][1]]; }
void modif(int ql, int qr, int v, int l = 1, int r = n, int &rt = root) {
  if (rt == 0) rt = ++P;
  if (ql <= l && r <= qr) {
    tag[rt] = v;
    sum[rt] = (r - l + 1) * v;
    return;
  }
  down(rt, l, r);
  int o = (l + r) >> 1;
  if (ql <= o) modif(ql, qr, v, l, o, c[rt][0]);
  if (qr > o) modif(ql, qr, v, o + 1, r, c[rt][1]);
  up(rt);
}
int main() {
  cin >> n >> Q;
  memset(tag, 255, sizeof(tag));
  while (Q--) {
    scanf("%d%d%d", &l, &r, &k);
    modif(l, r, 2 - k);
    printf("%d\n", n - sum[1]);
  }
  return 0;
}
