#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
inline int read() {
  register int x = 0, f = 1;
  register char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
struct node {
  int l, r;
  mutable bool v;
  node(int L, int R = -1, bool V = 0) : l(L), r(R), v(V) {}
  bool operator<(const node& o) const { return l < o.l; }
};
set<node> s;
int sum = 0;
set<node>::iterator split(int pos) {
  set<node>::iterator it = s.lower_bound(node(pos));
  if (it != s.end() && it->l == pos) return it;
  --it;
  int L = it->l, R = it->r;
  bool V = it->v;
  s.erase(it);
  s.insert(node(L, pos - 1, V));
  return s.insert(node(pos, R, V)).first;
}
void assign_val(int l, int r, bool val) {
  set<node>::iterator itr = split(r + 1), itl = split(l), it = itl;
  for (; itl != itr; ++itl) sum -= itl->v * (itl->r - itl->l + 1);
  s.erase(it, itr);
  s.insert(node(l, r, val));
  sum += val * (r - l + 1);
}
int main() {
  int n = read(), m = read();
  s.insert(node(1, n, 1));
  sum = n;
  while (m--) {
    int l = read(), r = read(), op = read();
    if (op == 1)
      assign_val(l, r, 0);
    else
      assign_val(l, r, 1);
    printf("%d\n", sum);
  }
  return 0;
}
