import sys import pypyjit import itertools import heapq import math from collections import deque, defaultdict import bisect input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) pypyjit.set_param('max_unroll_recursion=-1') def index_lt(a, x): 'return largest index s.t. A[i] < x or -1 if it does not exist' return bisect.bisect_left(a, x) - 1 def index_le(a, x): 'return largest index s.t. A[i] <= x or -1 if it does not exist' return bisect.bisect_right(a, x) - 1 def index_gt(a, x): 'return smallest index s.t. A[i] > x or len(a) if it does not exist' return bisect.bisect_right(a, x) def index_ge(a, x): 'return smallest index s.t. A[i] >= x or len(a) if it does not exist' return bisect.bisect_left(a, x) class LazySegTree_RUQ: def __init__(self, N, func, e): self.N = N self.func = func self.X = [e] * (N << 1) self.lazy = [None] * (N << 1) self.e = e def build(self, seq): for i in range(self.N): self.X[self.N + i] = seq[i] for i in range(self.N)[::-1]: self.X[i] = self.func(self.X[i << 1], self.X[i << 1 | 1]) def gindex(self, l, r): l += self.N r += self.N lm = l >> (l & -l).bit_length() rm = r >> (r & -r).bit_length() while r > l: if l <= lm: yield l if r <= rm: yield r r >>= 1 l >>= 1 while l: yield l l >>= 1 def propagates(self, *ids): for i in ids[::-1]: v = self.lazy[i] if v is None: continue self.lazy[i << 1] = v self.lazy[i << 1 | 1] = v self.X[i << 1] = v self.X[i << 1 | 1] = v self.lazy[i] = None def update(self, L, R, x): *ids, = self.gindex(L, R) self.propagates(*ids) L += self.N R += self.N while L < R: if L & 1: self.lazy[L] = x self.X[L] = x L += 1 if R & 1: R -= 1 self.lazy[R] = x self.X[R] = x L >>= 1 R >>= 1 for i in ids: self.X[i] = self.func(self.X[i << 1], self.X[i << 1 | 1]) def query(self, L, R): *ids, = self.gindex(L, R) self.propagates(*ids) L += self.N R += self.N vL = self.e vR = self.e while L < R: if L & 1: vL = self.func(vL, self.X[L]) L += 1 if R & 1: R -= 1 vR = self.func(self.X[R], vR) L >>= 1 R >>= 1 return self.func(vL, vR) N, Q = map(int, input().split()) query = [tuple(map(int, input().split())) for _ in range(Q)] query.sort(key=lambda x: x[2]) lst = LazySegTree_RUQ(N, min, 10 ** 9) lst.build([10 ** 9] * N) for l, r, B in query: l -= 1 lst.update(l, r, B) for l, r, B in query: l -= 1 m = lst.query(l, r) if m != B: print(-1) exit() print(*lst.X[N:])