#include <bits/stdc++.h>
using namespace std;
const int mod = (1e9) + 7;
const int siz = (1e5) + 5;
int n, q;
struct s {
  int l, r, k;
};
struct cmp {
  bool operator()(s a, s b) const { return a.l < b.l; }
};
set<s, cmp> ms;
int ks[4];
int main() {
  scanf("%d%d", &n, &q);
  ms.insert({1, n, 2});
  ks[2] = n;
  while (q--) {
    int l, r, k;
    scanf("%d%d%d", &l, &r, &k);
    vector<multiset<s>::iterator> del;
    vector<s> add;
    add.push_back({l, r, k});
    auto itt = ms.lower_bound({l, 0, 0});
    auto it = itt;
    while (true) {
      if (it == ms.end() || (*it).l > r) break;
      if ((*it).r <= r) {
        ks[(*it).k] -= ((*it).r - (*it).l + 1);
      } else {
        ks[(*it).k] -= (r - (*it).l + 1);
        add.push_back({r + 1, (*it).r, (*it).k});
      }
      del.push_back(it);
      it++;
    }
    it = itt;
    if (it != ms.end() && it != ms.begin()) {
      it--;
    } else if (it == ms.end()) {
      it = ms.find(*ms.rbegin());
    } else {
      it = ms.end();
    }
    if (it != ms.end()) {
      if ((*it).r >= l) {
        del.push_back(it);
        add.push_back({(*it).l, l - 1, (*it).k});
        ks[(*it).k] -= (*it).r - l + 1;
        if ((*it).r > r) {
          add.push_back({r + 1, (*it).r, (*it).k});
          ks[(*it).k] += (*it).r - r;
        }
      }
    }
    ks[k] += r - l + 1;
    for (auto v : del) ms.erase(v);
    for (auto v : add) {
      ms.insert({v.l, v.r, v.k});
    }
    printf("%d\n", ks[2]);
  }
  return 0;
}
