import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.PriorityQueue; import java.util.Set; import java.util.TreeSet; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int n = Integer.parseInt(sa[0]); int q = Integer.parseInt(sa[1]); PriorityQueue que = new PriorityQueue<>((o1, o2) -> o2.b - o1.b); for (int i = 0; i < q; i++) { sa = br.readLine().split(" "); Obj o = new Obj(); o.l = Integer.parseInt(sa[0]) - 1; o.r = Integer.parseInt(sa[1]); o.b = Integer.parseInt(sa[2]); que.add(o); } br.close(); int[] a = new int[n]; Arrays.fill(a, 1); TreeSet set = new TreeSet<>(); for (int i = 0; i < n; i++) { set.add(i); } Obj pre = null; while (!que.isEmpty()) { Obj o = que.poll(); Set ss = set.subSet(o.l, o.r); if (pre != null && o.b < pre.b && ss.isEmpty()) { System.out.println(-1); return; } for (int i : ss) { a[i] = o.b; } ss.clear(); pre = o; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { sb.append(a[i]).append(' '); } sb.deleteCharAt(sb.length() - 1); System.out.println(sb.toString()); } static class Obj { int l, r, b; } }