#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
set<pair<int, int> > s;
int n, q;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  int res = n, op, L, R;
  while (q--) {
    cin >> L >> R >> op;
    auto it = s.lower_bound(pair<int, int>(L, 0));
    while (it != s.end()) {
      int l = (*it).second, r = (*it).first;
      int len = min(R, r) - max(l, L) + 1;
      if (len <= 0) break;
      res += len;
      s.erase(it++);
      if (l < L) s.insert(pair<int, int>(L - 1, l));
      if (r > R) s.insert(pair<int, int>(r, R + 1));
    }
    if (op == 1) {
      res -= (R - L + 1);
      s.insert(pair<int, int>(R, L));
    }
    cout << res << "\n";
  }
  return 0;
}
