#include <bits/stdc++.h>
struct Interval {
  int left, right;
  bool operator<(const Interval& other) const {
    return this->right < other.right;
  }
};
std::set<Interval> intervals;
int answer;
void init(int n) {
  answer = n;
  intervals.insert(Interval{1, n});
}
void split(int value) {
  std::set<Interval>::iterator it = intervals.lower_bound(Interval{0, value});
  if (it->left <= value && value + 1 <= it->right) {
    Interval interval = *it;
    intervals.erase(it);
    intervals.insert(Interval{interval.left, value});
    intervals.insert(Interval{value + 1, interval.right});
  }
}
void eraseRange(int left, int right) {
  std::set<Interval>::iterator it = intervals.lower_bound(Interval{0, left});
  std::set<Interval>::iterator it2 = intervals.upper_bound(Interval{0, right});
  while (it != it2) {
    answer -= it->right - it->left + 1;
    auto aux = it;
    it++;
    intervals.erase(aux);
  }
}
int updateQuery(int left, int right, bool newValue) {
  split(left - 1);
  split(right);
  eraseRange(left, right);
  if (newValue) {
    answer += right - left + 1;
    intervals.insert(Interval{left, right});
  }
  return answer;
}
int main() {
  int n, Q;
  scanf("%d%d", &n, &Q);
  init(n);
  while (Q--) {
    int l, r, v;
    bool value;
    scanf("%d%d%d", &l, &r, &v);
    value = (v == 2);
    printf("%d\n", updateQuery(l, r, value));
  }
  return 0;
}
