#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  register char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (48 ^ c), c = getchar();
  return x;
}
int N, Q, SUM;
struct Chtholly {
  int l, r;
  mutable bool Day;
  Chtholly(int A = 0, int B = -1, bool C = 1) : l(A), r(B), Day(C) {}
  bool operator<(const Chtholly &binary) const { return l < binary.l; }
};
set<Chtholly> Holiday;
inline set<Chtholly>::iterator split(int pos) {
  set<Chtholly>::iterator res = Holiday.lower_bound(Chtholly(pos));
  if (res != Holiday.end() && res->l == pos) return res;
  --res;
  int L = res->l, R = res->r;
  bool B = res->Day;
  Holiday.erase(res);
  Holiday.insert(Chtholly(L, pos - 1, B));
  return Holiday.insert(Chtholly(pos, R, B)).first;
}
inline void assign(int L, int R, bool C) {
  set<Chtholly>::iterator Lp = split(L), Rp = split(R + 1), p;
  Lp = Holiday.lower_bound(Chtholly(L));
  p = Lp;
  for (; p != Rp; ++p) SUM -= (int)(p->Day) * (p->r - p->l + 1);
  Holiday.erase(Lp, Rp);
  Holiday.insert(Chtholly(L, R, C));
  SUM += (int)(C) * (R - L + 1);
}
int main() {
  N = read(), Q = read();
  SUM = N;
  Holiday.insert(Chtholly(1, N, 1));
  while (Q--) {
    int l = read(), r = read();
    if (read() == 1)
      assign(l, r, 0);
    else
      assign(l, r, 1);
    printf("%d\n", SUM);
  }
}
