from sys import stdin n, q, *indata = map(int, stdin.read().split()) offset = 0 querytable = [] for i in range(q): s, t, b = indata[offset + 3*i],indata[offset + 3*i+1],indata[offset + 3*i+2] querytable.append((b,s,t)) # N: 処理する区間の長さ INF = 10**9 LV = (n+1).bit_length() N0 = 2**LV data = [INF]*(2*N0) lazy = [None]*(2*N0) # 伝搬対象の区間を求める def gindex(l, r): L = (l + N0) >> 1; R = (r + N0) >> 1 lc = 0 if l & 1 else (L & -L).bit_length() rc = 0 if r & 1 else (R & -R).bit_length() for i in range(LV): if rc <= i: yield R if L < R and lc <= i: yield L L >>= 1; R >>= 1 # 遅延伝搬処理 def propagates(*ids): for i in reversed(ids): v = lazy[i-1] if v is None: continue lazy[2*i-1] = data[2*i-1] = lazy[2*i] = data[2*i] = v lazy[i-1] = None # 区間[l, r)をxで更新 def update(l, r, x): *ids, = gindex(l, r) propagates(*ids) L = N0 + l; R = N0 + r while L < R: if R & 1: R -= 1 lazy[R-1] = data[R-1] = x if L & 1: lazy[L-1] = data[L-1] = x L += 1 L >>= 1; R >>= 1 for i in ids: data[i-1] = min(data[2*i-1], data[2*i]) # 区間[l, r)内の最小値を求める def query(l, r): propagates(*gindex(l, r)) L = N0 + l; R = N0 + r s = INF while L < R: if R & 1: R -= 1 s = min(s, data[R-1]) if L & 1: s = min(s, data[L-1]) L += 1 L >>= 1; R >>= 1 return s for i in range(q): b, s, t = querytable[i] update(s,t+1,b) for i in range(q): b, s, t = querytable[i] val = query(s,t+1) if val != b: print(-1) exit() ans = [0 for i in range(n)] for i in range(n): val = query(i+1,i+2) ans[i] = str(val) L=' '.join(ans) print(L)