#include <bits/stdc++.h>
using namespace std;
struct Interval {
  int l, r;
  bool operator<(const Interval other) const { return l < other.l; }
};
int N, Q;
int inset;
set<Interval> s;
void Split(int f) {
  if (f == 0) return;
  set<Interval>::iterator it = s.upper_bound({f, 0});
  if (it == s.begin()) return;
  --it;
  Interval i = *it;
  if (i.r < f) return;
  s.erase(it);
  s.insert({i.l, f});
  if (f + 1 <= i.r) {
    s.insert({f + 1, i.r});
  }
}
void EraseRange(int left, int right) {
  set<Interval>::iterator it = s.lower_bound({left, 0});
  while (it != s.upper_bound({right, 0})) {
    Interval interval = *(it);
    inset -= (interval.r - interval.l + 1);
    it = s.erase(it);
  }
}
void Solve(int left, int right, int type) {
  Split(left - 1);
  Split(right);
  EraseRange(left, right);
  if (type == 2) {
    s.insert({left, right});
    inset += (right - left + 1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> Q;
  s.insert({1, N}), inset = N;
  for (int i = 1; i <= Q; i++) {
    int l, r, t;
    cin >> l >> r >> t;
    Solve(l, r, t);
    cout << inset << '\n';
  }
  return 0;
}
