#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
using namespace std;
const long double two = 2;
const long double INF = 2e18 + 100;
const long long MOD = 998244353;
const long long N = 1e5 + 10;
const long long nul = 0;
const long long SIZE = 1e6 * 3;
struct exam {
  long long s, d, c, ind;
  exam(long long s1, long long d1, long long c1, long long ind1) {
    s = s1;
    d = d1;
    c = c1;
    ind = ind1;
  }
};
vector<long long> ans;
vector<exam> smth;
bool lol(long long st, long long len, long long fin, long long ind) {
  long long i = st;
  while (len--) {
    while (ans[i] != 0 && i < fin) i++;
    if (i == fin) return 0;
    ans[i] = ind + 1;
  }
  return 1;
}
bool comp(exam a, exam b) {
  if (a.d < b.d)
    return 1;
  else
    return 0;
}
signed main() {
  long long n, m;
  cin >> n >> m;
  ans.resize(n, 0);
  smth;
  for (long long i = 0; i < m; i++) {
    long long s, d, c;
    cin >> s >> d >> c;
    s--;
    d--;
    ans[d] = m + 1;
    smth.push_back(exam(s, d, c, i));
  }
  sort((smth).begin(), (smth).end(), comp);
  bool flag = 0;
  for (long long i = 0; i < m; i++) {
    if (lol(smth[i].s, smth[i].c, smth[i].d, smth[i].ind) == 0) flag = 1;
  }
  if (flag)
    cout << -1 << endl;
  else {
    for (long long i : ans) cout << i << " ";
    cout << endl;
  }
}
