#include <bits/stdc++.h>
using namespace std;
int n, q;
int state;
set<pair<int, int> > S;
void add(int l, int r) {
  state -= (r - l + 1);
  S.insert(make_pair(l, r));
}
void remove(set<pair<int, int> >::iterator x) {
  state += (x->second - x->first + 1);
  S.erase(x);
}
void clean(int l, int r) {
  if (!S.empty()) {
    __typeof(S.lower_bound(make_pair(l, l))) right =
        (S.lower_bound(make_pair(l, l)));
    while (right != S.end() && right->first <= r) {
      if (right->second <= r) {
        remove(right);
        right = S.lower_bound(make_pair(l, l));
      } else {
        int r_right = right->second;
        remove(right);
        add(r + 1, r_right);
        break;
      }
    }
    __typeof(S.lower_bound(make_pair(l, l))) left =
        (S.lower_bound(make_pair(l, l)));
    if (left != S.begin()) {
      left--;
      if (left->second >= l) {
        pair<int, int> to_correct = *left;
        remove(left);
        add(to_correct.first, l - 1);
        if (to_correct.second > r) add(r + 1, to_correct.second);
      }
    }
  }
}
void update(int l, int r, int k) {
  clean(l, r);
  if (k == 1) {
    add(l, r);
  }
}
int main() {
  scanf("%d%d", &n, &q);
  state = n;
  while (q--) {
    int l, r, k;
    scanf("%d%d%d", &l, &r, &k);
    update(l, r, k);
    printf("%d\n", state);
  }
  return 0;
}
