from collections import defaultdict import heapq n,q = map(int,input().split()) lr = [[int(i)-1 for i in input().split()] for j in range(q)] lr.sort(key=lambda x:x[0]) li = [10**9]*n rm = defaultdict(int) idx = 0 lrcnt = 0 hp = [] heapq.heapify(hp) rmhp = [] heapq.heapify(rmhp) while idx < n: while lrcnt < q and lr[lrcnt][0] <= idx: heapq.heappush(hp, -lr[lrcnt][2]) heapq.heappush(rmhp, [lr[lrcnt][1],-lr[lrcnt][2]]) lrcnt += 1 while 1: if len(rmhp) == 0: break pos,val = heapq.heappop(rmhp) if pos < idx: rm[val] += 1 else: heapq.heappush(rmhp, [pos,val]) break while 1: if len(hp) == 0: li[idx] = 10**9 break val = heapq.heappop(hp) if rm[val] > 0: rm[val] -= 1 else: li[idx] = -val+1 heapq.heappush(hp, val) break idx += 1 print(*li)