import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int N = sc.nextInt(); int Q = sc.nextInt(); boolean ok = true; int[] A = new int[N]; Triplet[] tri = new Triplet[Q]; TreeSet tset = new TreeSet<>(); SegmentTree smt = new SegmentTree(); for( int i = 0; i < N; i++ ) { A[i] = 1000000000; smt.insert(i,A[i]); tset.add(i); } for( int i = 0; i < Q; i++ ) { int l = sc.nextInt()-1; int r = sc.nextInt()-1; int b = sc.nextInt(); tri[i] = new Triplet(l,r,b); } Arrays.sort( tri, (t0,t1) -> t1.b-t0.b ); for( int i = 0; i < Q; i++ ) { Triplet t = tri[i]; if( tset.ceiling(t.l) == null || tset.ceiling(t.l) > t.r ) continue; while( !tset.isEmpty() && tset.ceiling(t.l) != null && tset.ceiling(t.l) <= t.r ) { int index = tset.ceiling(t.l); tset.remove(index); A[index] = t.b; smt.insert(index,A[index]); } } for( int i = 0; i < Q; i++ ) { Triplet t = tri[i]; if( smt.rmq(t.l,t.r) != t.b ) ok = false; } if(ok) { for( int i = 0; i < N; i++ ) { if( i == N-1 ) pw.println(A[i]); else pw.print(A[i]+" "); } }else { pw.println(-1); } pw.flush(); } } class SegmentTree { int N = 262144; int[] val; public SegmentTree() { this.val = new int[2*N+1]; for( int i = 0; i < 2*N+1; i++ ) { val[i] = Integer.MAX_VALUE; } } public void insert(int id, int x) { id += N; val[id] = x; while( id > 1 ) { id >>= 1; val[id] = Math.min(val[(id<<1)|0],val[(id<<1)|1]); } } public int rmq(int l, int r) { int res = Integer.MAX_VALUE; l += N; r += N; while( l < r ) { if( l%2 == 1 ) res = Math.min(res,val[l++]); if( r%2 == 1 ) res = Math.min(res,val[--r]); l >>= 1; r >>= 1; } return res; } } class Triplet { int l,r,b; public Triplet(int l, int r, int b) { this.l = l; this.r = r; this.b = b; } }