#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int ans[n];
  for (int i = 0; i < n; i++) ans[i] = -1;
  int k = sqrt(n);
  if (n % k > 0) k++;
  set<int> s[n / k + 1];
  for (int i = 0; i < n; i++) {
    s[i / k].insert(i);
  }
  while (m--) {
    int l, r, winner;
    scanf("%d%d%d", &l, &r, &winner);
    l--;
    r--;
    winner--;
    for (int i = l; i <= r && i / k == l / k; i++)
      if (ans[i] == -1 && winner != i) {
        ans[i] = winner;
        s[i / k].erase(i);
      }
    for (int i = r; i >= l && i / k == r / k; i--)
      if (ans[i] == -1 && winner != i) {
        ans[i] = winner;
        s[i / k].erase(i);
      }
    int i = l;
    while (i <= r)
      if (i / k == l / k)
        i++;
      else
        break;
    for (; i + k - 1 <= r; i += k) {
      for (set<int>::iterator j = s[i / k].begin(); j != s[i / k].end(); j++)
        if (winner != *j) ans[*j] = winner;
      s[i / k].clear();
    }
    s[winner / k].insert(winner);
  }
  for (int i = 0; i < n; i++) printf("%d ", ans[i] + 1);
  return 0;
}
