#include <bits/stdc++.h>
using namespace std;
const int N = 15e6 + 10;
int n, m;
int lc[N], rc[N], lazy[N], val[N], cnt;
void pushdown(int i, int L, int R) {
  if (lazy[i] != -1) {
    int mid = (L + R) / 2;
    if (lc[i] == 0) lc[i] = ++cnt;
    lazy[lc[i]] = lazy[i];
    val[lc[i]] = (mid - L + 1) * lazy[lc[i]];
    if (rc[i] == 0) rc[i] = ++cnt;
    lazy[rc[i]] = lazy[i];
    val[rc[i]] = (R - mid) * lazy[rc[i]];
    lazy[i] = -1;
  }
}
void pushup(int x) {
  val[x] = 0;
  if (lc[x]) val[x] += val[lc[x]];
  if (rc[x]) val[x] += val[rc[x]];
}
void change(int &x, int L, int R, int l, int r, int v) {
  if (!x) x = ++cnt;
  if (l <= L && R <= r) {
    val[x] = (R - L + 1) * v;
    lazy[x] = v;
    return;
  }
  int mid = (L + R) / 2;
  pushdown(x, L, R);
  if (l <= mid) change(lc[x], L, mid, l, r, v);
  if (mid < r) change(rc[x], mid + 1, R, l, r, v);
  pushup(x);
}
int main() {
  scanf("%d%d", &n, &m);
  memset(lazy, -1, sizeof lazy);
  int root = 0;
  change(root, 1, n, 1, n, 1);
  while (m--) {
    int l, r, k;
    scanf("%d%d%d", &l, &r, &k);
    change(root, 1, n, l, r, k - 1);
    printf("%d\n", val[root]);
  }
  return 0;
}
