#include <bits/stdc++.h>
using namespace std;
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& next) const { return l < next.l; }
};
set<node> Chtholly_tree;
int n, q;
set<node>::iterator split(int pos) {
  set<node>::iterator it = Chtholly_tree.lower_bound(node(pos));
  if (it != Chtholly_tree.end() && it->l == pos) return it;
  it--;
  int l = it->l;
  int r = it->r;
  int v = it->v;
  Chtholly_tree.erase(it);
  Chtholly_tree.insert(node(l, pos - 1, v));
  return Chtholly_tree.insert(node(pos, r, v)).first;
}
int main() {
  scanf("%d%d", &n, &q);
  int ans = n;
  Chtholly_tree.insert(node(1, n, 1));
  for (int i = 1; i <= q; i++) {
    int type, l, r;
    scanf("%d%d%d", &l, &r, &type);
    if (type == 1) {
      set<node>::iterator right = split(r + 1);
      set<node>::iterator left = split(l);
      set<node>::iterator it = left;
      for (; it != right; it++) ans -= it->v * (it->r - it->l + 1);
      Chtholly_tree.erase(left, right);
      Chtholly_tree.insert(node(l, r, 0));
    } else {
      set<node>::iterator right = split(r + 1);
      set<node>::iterator left = split(l);
      set<node>::iterator it = left;
      for (; it != right; it++) ans -= it->v * (it->r - it->l + 1);
      Chtholly_tree.erase(left, right);
      Chtholly_tree.insert(node(l, r, 1));
      ans += r - l + 1;
    }
    printf("%d\n", ans);
  }
  return 0;
}
