#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > st;
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  int ans = n;
  for (int i = 1; i <= q; i++) {
    int t, l, r;
    cin >> l >> r >> t;
    vector<pair<int, int> > v;
    for (auto it = st.lower_bound(make_pair(l, -1));
         it != st.end() && it->second <= r; ++it) {
      v.push_back(*it);
    }
    if (t == 1) {
      for (auto [q, p] : v) {
        l = min(l, p);
        r = max(r, q);
        ans += q - p + 1;
        st.erase(make_pair(q, p));
      }
      ans -= r - l + 1;
      st.insert(make_pair(r, l));
    } else {
      for (auto [q, p] : v) {
        int px = max(l, p), qx = min(r, q);
        ans += qx - px + 1;
        st.erase(make_pair(q, p));
      }
      for (auto [q, p] : v) {
        if (p < l) st.insert(make_pair(l - 1, p));
        if (q > r) st.insert(make_pair(q, r + 1));
      }
    }
    cout << ans << "\n";
  }
}
