#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005, MAXM = 500005 << 1, INF = 2147483647;
int g[MAXN], l, r, x, ans[MAXN];
bool ban[MAXN];
struct edges {
  int to, next, cap, flow;
} e[MAXM];
int tot = 1, head, tail, q[MAXN], dis[MAXN], vist[MAXN], s, t, maxp, temp[MAXN];
int min1(int a1, int b1) { return a1 < b1 ? a1 : b1; }
void adds(int a1, int b1, int c1) {
  tot++;
  e[tot].to = b1;
  e[tot].cap = c1;
  e[tot].next = g[a1];
  e[tot].flow = 0;
  g[a1] = tot;
  return;
}
void add_edge(int a1, int b1, int c1) {
  adds(a1, b1, c1);
  adds(b1, a1, 0);
  return;
}
bool bfs() {
  for (int i = 0; i <= maxp; i++) {
    vist[i] = false;
  }
  head = 0;
  tail = 1;
  q[tail] = s;
  vist[s] = true;
  while (head != tail) {
    head++;
    int x = q[head];
    for (int i = g[x]; i; i = e[i].next) {
      if (e[i].cap > e[i].flow && !vist[e[i].to]) {
        tail++;
        q[tail] = e[i].to;
        vist[e[i].to] = true;
        dis[e[i].to] = dis[x] + 1;
      }
    }
  }
  return vist[t];
}
int dfs(int now, int mins) {
  if (now == t || mins == 0) return mins;
  int now_flow = 0, next_flow;
  for (; temp[now]; temp[now] = e[temp[now]].next) {
    if (dis[e[temp[now]].to] == dis[now] + 1) {
      next_flow = dfs(e[temp[now]].to,
                      min1(mins, e[temp[now]].cap - e[temp[now]].flow));
      if (next_flow > 0) {
        e[temp[now]].flow += next_flow;
        e[temp[now] ^ 1].flow -= next_flow;
        now_flow += next_flow;
        mins -= next_flow;
        if (mins == 0) break;
      }
    }
  }
  return now_flow;
}
int dinic() {
  int ans = 0;
  while (bfs()) {
    for (int i = 0; i <= maxp; ++i) {
      temp[i] = g[i];
    }
    ans += dfs(s, INF);
  }
  return ans;
}
void init() {
  memset(g, 0, sizeof(g));
  tot = 1;
  return;
}
int sum, n, m;
int main() {
  init();
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d %d %d", &l, &r, &x);
    if (ans[r]) {
      printf("-1");
      return 0;
    } else {
      ans[r] = m + 1;
    }
    for (int j = l; j < r; ++j) {
      add_edge(i, j + 200, 1);
    }
    add_edge(502, i, x);
    sum += x;
  }
  for (int i = 1; i <= n; ++i) {
    if (!ans[i]) add_edge(i + 200, 501, 1);
  }
  s = 502;
  t = 501;
  maxp = 502;
  if (dinic() == sum) {
    for (int i = 2; i <= tot; ++i) {
      if (e[i].to > 200 && e[i].to < 400 && e[i ^ 1].to > 0 &&
          e[i ^ 1].to <= 100 && e[i].flow) {
        ans[e[i].to - 200] = e[i ^ 1].to;
      }
    }
    for (int i = 1; i <= n; ++i) {
      printf("%d ", ans[i]);
    }
  } else {
    printf("-1\n");
  }
  return 0;
}
