#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  map<int, pair<int, int>> g;
  vector<vector<int>> r(n + 1);
  for (int i = 1; i <= m; i++) {
    int s, d, c;
    cin >> s >> d >> c;
    g[d] = {i, c};
    r[s].emplace_back(d);
  }
  priority_queue<int, vector<int>, greater<int>> pq;
  vector<int> res(n + 1);
  for (int i = 1; i <= n; i++) {
    for (auto &j : r[i]) {
      pq.emplace(j);
    }
    if (g.count(i)) {
      if (g[i].second == 0) {
        res[i] = m + 1;
      } else {
        cout << -1 << '\n';
        return 0;
      }
    } else {
      if (!pq.empty()) {
        int t = pq.top();
        g[t].second--;
        res[i] = g[t].first;
        if (g[t].second == 0) {
          pq.pop();
        }
      } else {
        res[i] = 0;
      }
    }
  }
  if (!pq.empty()) {
    cout << -1 << '\n';
  }
  for (int i = 1; i <= n; i++) {
    cout << res[i] << (i == n ? '\n' : ' ');
  }
}
