#include <bits/stdc++.h>
using namespace std;
set<pair<int, int>> s;
int total, MAX_N = 1e9 + 1;
void remove(int l, int r) {
  auto it = s.upper_bound({r, MAX_N}), aux = s.end();
  if (it == s.end() && s.size() && s.rbegin()->first <= r) {
    it = --s.end();
  } else {
    it = (it == s.begin()) ? s.end() : prev(it);
  }
  for (; it != s.end() && it->second >= l; it = aux) {
    aux = (it == s.begin()) ? s.end() : prev(it);
    total -= it->second - it->first + 1;
    if (it->first < l) {
      s.insert({it->first, l - 1});
      total += l - it->first;
    }
    if (it->second > r) {
      s.insert({r + 1, it->second});
      total += it->second - r;
    }
    s.erase({it->first, it->second});
  }
}
void add(int l, int r) {
  auto it = s.upper_bound({r + 1, MAX_N}), aux = s.end();
  if (it == s.end() && s.size() && s.rbegin()->first <= r + 1) {
    it = --s.end();
  } else {
    it = (it == s.begin()) ? s.end() : prev(it);
  }
  for (; it != s.end() && it->second >= l; it = aux) {
    aux = (it == s.begin()) ? s.end() : prev(it);
    r = max(r, it->second);
    l = min(l, it->first);
    total -= (it->second - it->first + 1);
    s.erase({it->first, it->second});
  }
  total += r - l + 1;
  s.insert({l, r});
}
int main() {
  ios::sync_with_stdio(false);
  int n, q, l, r, t;
  cin >> n >> q;
  s.insert({1, n});
  total = n;
  while (q--) {
    cin >> l >> r >> t;
    if (t == 1) {
      remove(l, r);
    } else {
      add(l, r);
    }
    cout << total << endl;
  }
}
