#include <bits/stdc++.h>
using namespace std;
int n, q, curDay;
set<pair<int, int> > s;
int main() {
  ios_base::sync_with_stdio(false);
  scanf("%d%d", &n, &q);
  curDay = n;
  for (int i = 0; i < q; ++i) {
    int l, r, k;
    scanf("%d%d%d", &l, &r, &k);
    set<pair<int, int> >::iterator it = s.lower_bound(make_pair(l, -999));
    while (it != s.end()) {
      int R = (*it).first, L = (*it).second;
      int len = min(r, R) - max(l, L) + 1;
      if (len <= 0) break;
      curDay += len;
      s.erase(it++);
      if (L < l) s.insert(make_pair(l - 1, L));
      if (R > r) s.insert(make_pair(R, r + 1));
    }
    if (k == 1) {
      s.insert(make_pair(r, l));
      curDay -= r - l + 1;
    }
    printf("%d\n", curDay);
  }
}
