#include <bits/stdc++.h>
static int M;
typedef struct {
  int start;
  int end;
  int winner;
} fight;
void dump(int *knights, int knights_cnt) {
  int j;
  for (j = 1; j < knights_cnt; j++) printf("%d ", knights[j]);
  printf("%d\n", knights[j]);
}
void update(int *alive, int n, int start, int end, int left, int right,
            int winner, int *knights) {
  int index, mid;
  if (alive[n] <= 0) return;
  if (left > end || right < start) return;
  if (start == end) {
    if (start != winner) {
      knights[start] = winner;
      index = n;
      while (index > 0) {
        alive[index] -= 1;
        index >>= 1;
      }
    }
    return;
  }
  mid = (start + end) / 2;
  if (left <= mid && mid <= right) {
    update(alive, n << 1, start, mid, left, mid, winner, knights);
    update(alive, (n << 1) | 1, mid + 1, end, mid + 1, right, winner, knights);
  } else if (mid < left)
    update(alive, (n << 1) | 1, mid + 1, end, left, right, winner, knights);
  else if (mid > right)
    update(alive, n << 1, start, mid, left, right, winner, knights);
}
int main(int argc, char **argv) {
  int knights_cnt;
  int fights_cnt;
  int *knights;
  int *alive;
  fight *fights;
  int i, j;
  scanf("%d %d\n", &knights_cnt, &fights_cnt);
  for (M = 1; M < knights_cnt + 2; M <<= 1)
    ;
  alive = (int *)calloc(M << 1, sizeof(int));
  for (i = 0; i < knights_cnt; i++)
    for (j = M + i; j > 0; j >>= 1) alive[j] += 1;
  knights = (int *)calloc(knights_cnt + 1, sizeof(int));
  fights = (fight *)calloc(fights_cnt, sizeof(fight));
  for (i = 0; i < fights_cnt; i++) {
    scanf("%d %d %d\n", &(fights[i].start), &(fights[i].end),
          &(fights[i].winner));
  }
  for (i = 0; i < fights_cnt; i++) {
    update(alive, 1, 1, M, fights[i].start, fights[i].end, fights[i].winner,
           knights);
  }
  dump(knights, knights_cnt);
  free(alive);
  free(fights);
  free(knights);
  return 0;
}
