#include <bits/stdc++.h>
using namespace std;
int n, q, sz;
set<pair<int, int> > rg;
void del(int l, int r) {
  while (!rg.empty()) {
    auto it = rg.lower_bound(make_pair(l, 0));
    if (it == rg.end()) break;
    if (it->first > r) break;
    int ri = it->second;
    if (ri <= r) {
      sz += it->second - it->first + 1;
      rg.erase(it);
    } else {
      sz += r - it->first + 1;
      rg.erase(it);
      rg.insert(make_pair(r + 1, ri));
    }
  }
  auto it = rg.lower_bound(make_pair(l, 0));
  if (it != rg.begin()) {
    --it;
    int le = it->first, ri = it->second;
    if (ri < l) return;
    if (ri <= r) {
      sz += ri - l + 1;
      rg.erase(it);
      rg.insert(make_pair(le, l - 1));
    } else {
      sz += r - l + 1;
      rg.erase(it);
      rg.insert(make_pair(le, l - 1));
      rg.insert(make_pair(r + 1, ri));
    }
  }
}
void add(int l, int r) {
  del(l, r);
  rg.insert(make_pair(l, r));
  sz -= r - l + 1;
}
void solve() {
  scanf("%d%d", &n, &q);
  sz = n;
  for (int i = 0; i < q; i++) {
    int l, r, k;
    scanf("%d%d%d", &l, &r, &k);
    if (k == 1)
      add(l, r);
    else
      del(l, r);
    printf("%d\n", sz);
  }
}
int main() {
  solve();
  return 0;
}
