n,q=map(int,input().split()) query=[] for i in range(q): l,r,b=map(int,input().split()) l-=1 r-=1 query+=[(b,l,r)] query.sort() B=int(n**0.5)+1 X=10**9 st1=[X]*B*B st2=[0]*B for b,l,r in query: y=l//B if st2[y]!=0: for i in range(y*B,y*B+B): st1[i]=st2[y] st2[y]=0 y=r//B if st2[y]!=0: for i in range(y*B,y*B+B): st1[i]=st2[y] st2[y]=0 if l//B==r//B: for i in range(l,r+1): st1[i]=b else: y=l//B for i in range(l,y*B+B): st1[i]=b y=r//B for i in range(y*B,r+1): st1[i]=b for i in range(l//B+1,r//B): st2[i]=b for y in range(B): if st2[y]!=0: for i in range(y*B,y*B+B): st1[i]=st2[y] st2[y]=min(st1[y*B:y*B+B]) f=1 for b,l,r in query: m=X if l//B==r//B: for i in range(l,r+1): m=min(m,st1[i]) else: y=l//B for i in range(l,y*B+B): m=min(m,st1[i]) y=r//B for i in range(y*B,r+1): m=min(m,st1[i]) for i in range(l//B+1,r//B): m=min(m,st2[i]) f&=m==b if f: print(*[st1[i] for i in range(n)]) else: print(-1)