#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long x = 0;
  int op = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') op = -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return x * op;
}
const int N = 15000010;
int n, m, rt, tot;
int sum[N], tag[N], L[N], R[N];
inline void pushdown(int o, int l, int r) {
  if (tag[o] == -1) return;
  if (!L[o]) L[o] = ++tot;
  if (!R[o]) R[o] = ++tot;
  tag[L[o]] = tag[R[o]] = tag[o];
  int mid = l + r >> 1;
  sum[L[o]] = (mid - l + 1) * tag[o];
  sum[R[o]] = (r - mid) * tag[o];
  tag[o] = -1;
}
inline void cover(int &o, int l, int r, int x, int y, int v) {
  if (!o) o = ++tot;
  if (l == x && r == y) {
    sum[o] = (r - l + 1) * v;
    tag[o] = v;
    return;
  }
  pushdown(o, l, r);
  int mid = l + r >> 1;
  if (y <= mid)
    cover(L[o], l, mid, x, y, v);
  else if (x > mid)
    cover(R[o], mid + 1, r, x, y, v);
  else {
    cover(L[o], l, mid, x, mid, v);
    cover(R[o], mid + 1, r, mid + 1, y, v);
  }
  sum[o] = sum[L[o]] + sum[R[o]];
}
int main() {
  n = read(), m = read();
  memset(tag, -1, sizeof tag);
  while (m--) {
    int l = read(), r = read(), opt = read();
    cover(rt, 1, n, l, r, 2 - opt);
    printf("%d\n", n - sum[rt]);
  }
  return 0;
}
