import sys import heapq input = sys.stdin.buffer.readline class Set_min(set): def __init__(self, iterable=tuple()): super(Set_min, self).__init__(iterable) self.h = list(set(iterable)) heapq.heapify(self.h) def add(self, x): super(Set_min, self).add(x) heapq.heappush(self.h, x) def remove(self, x): super(Set_min, self).remove(x) def min(self): if not super(Set_min, self).__len__(): raise ValueError while self.h and self.h[0] not in self: heapq.heappop(self.h) return self.h[0] N, Q = map(int, input().split()) MAX = 10 ** 9 h = [] queries = [[] for _ in range(N + 1)] for i in range(Q): l, r, b = map(int, input().split()) l -= 1 queries[l].append((b, i, 1)) queries[r].append((b, i, 2)) ans = [MAX] * N st1 = Set_min() st2 = Set_min() for i in range(N): for b, j, f in queries[i]: if f == 1: st1.add((-b, j)) else: # assert f == 2 if (-b, j) in st1: print(-1) exit() else: st2.remove((-b, j)) if st1: q = st1.min() if st2 and -q[0] < -st2.min()[0]: continue st1.remove(q) ans[i] = -q[0] st2.add(q) for b, j, f in queries[N]: if (-b, j) in st1: print(-1) exit() print(*ans)