#include <bits/stdc++.h>
using namespace std;
map<int, int> working;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  working[-1] = -1;
  working[2E9] = 2E9;
  working[1] = n;
  int answer = n;
  while (q--) {
    int l, r, k;
    cin >> l >> r >> k;
    int haveNow = 0;
    map<int, int>::iterator it = working.lower_bound(l);
    it--;
    if (it->second >= l) {
      working[l] = it->second;
      it->second = l - 1;
    }
    it++;
    while (it->first <= r) {
      if (it->second > r) {
        haveNow += r + 1 - it->first;
        working[r + 1] = it->second;
      } else
        haveNow += it->second - it->first + 1;
      map<int, int>::iterator it2 = it;
      it++;
      working.erase(it2);
    }
    if (k == 1) {
      answer -= haveNow;
    } else {
      answer -= haveNow;
      working[l] = r;
      answer += r - l + 1;
    }
    cout << answer << "\n";
  }
  return 0;
}
