#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > work;
int ans;
void debug() {
  for (auto it : work) {
    cout << it.first << " " << it.second << endl;
  }
}
void solve(int k, int l, int r) {
  if (k == 1) {
    if (work.empty()) {
      return;
    }
    auto it = work.lower_bound(pair<int, int>(l, r));
    if (it == work.begin()) {
      pair<int, int> temp;
      while (it != work.end() && (*it).first <= r) {
        temp = *it;
        ans -= temp.second - temp.first + 1;
        work.erase(it++);
      }
      if (temp.second > r && temp.first <= r) {
        work.insert(pair<int, int>(r + 1, temp.second));
        ans += temp.second - r;
      }
    } else {
      --it;
      pair<int, int> temp = *it;
      if (temp.first < l && temp.second >= l) {
        pair<int, int> ins = pair<int, int>(temp.first, l - 1);
        while (it != work.end() && (*it).first <= r) {
          temp = *it;
          ans -= temp.second - temp.first + 1;
          work.erase(it++);
        }
        if (temp.second > r && temp.first <= r) {
          work.insert(pair<int, int>(r + 1, temp.second));
          ans += temp.second - r;
        }
        work.insert(ins);
        ans += ins.second - ins.first + 1;
      } else {
        if ((*it).second < l) {
          it++;
        }
        while (it != work.end() && (*it).first <= r) {
          temp = *it;
          ans -= temp.second - temp.first + 1;
          work.erase(it++);
        }
        if (temp.second > r && temp.first <= r) {
          work.insert(pair<int, int>(r + 1, temp.second));
          ans += temp.second - r;
        }
      }
    }
  } else {
    auto it = work.lower_bound(pair<int, int>(l, r));
    if (work.empty()) {
      work.insert(pair<int, int>(l, r));
      ans += r - l + 1;
      return;
    }
    if (it == work.begin()) {
      pair<int, int> temp;
      while (it != work.end() && (*it).first <= r) {
        temp = *it;
        ans -= temp.second - temp.first + 1;
        work.erase(it++);
      }
      int maxr = max(r, temp.second);
      ans += maxr - l + 1;
      work.insert(pair<int, int>(l, maxr));
    } else {
      --it;
      if ((*it).second < l) {
        it++;
      } else if ((*it).first < l && (*it).second >= l) {
        l = (*it).first;
      }
      pair<int, int> temp;
      while (it != work.end() && (*it).first <= r) {
        temp = *it;
        ans -= temp.second - temp.first + 1;
        work.erase(it++);
      }
      int maxr = max(r, temp.second);
      ans += maxr - l + 1;
      work.insert(pair<int, int>(l, maxr));
    }
  }
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  ans = n;
  work.insert(pair<int, int>(1, n));
  for (int i = 0; i < q; i++) {
    int k, l, r;
    scanf("%d%d%d", &l, &r, &k);
    solve(k, l, r);
    printf("%d\n", ans);
  }
  return 0;
}
