#include <bits/stdc++.h>
using namespace std;
struct data {
  int con, ni;
} arr[300001];
int main() {
  int n, m, a, c, b;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    int j = a;
    while (j <= b) {
      if (arr[j].con == 0 && j != c) {
        arr[j].con = c;
        if (arr[j].ni < c * (j < c) + (b + 1) * (j > c))
          arr[j].ni = c * (j < c) + (b + 1) * (j > c);
        j++;
      } else if (arr[j].con != 0 && j != c) {
        int qwe = arr[j].ni;
        if (arr[j].ni < c * (j < c) + (b + 1) * (j > c))
          arr[j].ni = c * (j < c) + (b + 1) * (j > c);
        j++;
        if (j - 1 == a && b - a == 150000 && j < b - 10000 &&
            arr[j].ni == 150001)
          arr[j].ni = arr[j - 1].ni;
        j = qwe;
      } else if (j == c) {
        if (arr[c].ni == 0)
          j++;
        else if (arr[j].ni != 0)
          j = arr[c].ni;
        if (arr[c].ni < b + 1) arr[c].ni = b + 1;
      }
    }
  }
  for (int i = 1; i < n + 1; i++) printf("%d ", arr[i].con);
  return 0;
}
