# 公共钥匙盒
from collections import defaultdict
n, k = map(int, input().split())
timeline = defaultdict(list)
for i in range(k):
w, s, c = map(int, input().split())
timeline[s].append(w)#取出为正
timeline[s + c].append(w - n) # 方便排序,从小到大归还 归还为负
box = list(range(1, n + 1))
for t in sorted(timeline.keys()):
timeline[t].sort()
for x in timeline[t]:
if x <= 0: # 还钥匙
box[box.index('X')] = x + n
else: # 借钥匙
box[box.index(x)] = 'X'
# print(" ".join(map(str, box)))
for i in box:
print(i,end=" ")