#include <bits/stdc++.h>
using namespace std;
struct node {
  int l, r;
  mutable int val;
  node(int L, int R = -1, int V = 0) : l(L), r(R), val(V) {}
  node() {}
  bool operator<(const node x) const { return l < x.l; }
};
int n, T, op, l, r, ans, p;
set<node> s;
set<node>::iterator Itl, Itr;
int read() {
  register int s = 0;
  register char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    s = (s << 1) + (s << 3) + c - '0';
    c = getchar();
  }
  return s;
}
set<node>::iterator Split(register int pos) {
  register set<node>::iterator it = s.lower_bound(node(pos));
  if (it != s.end() && it->l == pos) return it;
  --it;
  if (pos > it->r) return s.end();
  register int l = it->l, r = it->r;
  register int val = it->val;
  s.erase(it);
  s.insert(node(l, pos - 1, val));
  return s.insert(node(pos, r, val)).first;
}
void Cov() {
  Itr = Split(r + 1);
  Itl = Split(l);
  register set<node>::iterator it = Itl;
  for (; it != Itr; it++) ans -= (it->r - it->l + 1) * it->val;
  s.erase(Itl, Itr);
  s.insert(node(l, r, p));
  ans += (r - l + 1) * p;
  printf("%d\n", ans);
}
int main() {
  int i, j;
  n = read();
  T = read();
  ans = n;
  s.insert(node(1, n, 1));
  while (T--) {
    l = read();
    r = read();
    p = read() - 1;
    Cov();
  }
  return 0;
}
