#include <bits/stdc++.h>
using namespace std;
long long t, n, i, j, k, b[200005], c[200005], x, y, m, l, r, mid, ans, s, mn,
    mx, z;
struct num {
  long long x, y, z, id;
} a[200005];
vector<long long> v;
priority_queue<pair<long long, pair<long long, long long> > > p;
bool srt(num a, num b) {
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    cin >> a[i].x >> a[i].y >> a[i].z;
    a[i].id = i + 1;
    c[a[i].id] = a[i].z;
    b[a[i].y] = 1;
  }
  sort(a, a + m, srt);
  j = 0;
  for (i = 1; i <= n; i++) {
    while (j < m && a[j].x == i) {
      p.push({-a[j].y, {a[j].z, a[j].id}});
      j++;
    }
    if (b[i]) {
      v.push_back(m + 1);
      continue;
    }
    if (p.size()) {
      x = -p.top().first;
      y = p.top().second.first;
      z = p.top().second.second;
      p.pop();
      if (i > x) return cout << -1, 0;
      if (--c[z]) p.push({-x, {y - 1, z}});
      v.push_back(z);
    } else
      v.push_back(0);
  }
  if (p.size()) return cout << -1, 0;
  for (i = 0; i < v.size(); i++) cout << v[i] << " ";
}
