import java.io.*; import java.util.*; public class Main { static final int MAX = 1000000000; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int q = sc.nextInt(); int[] ans = new int[n]; TreeSet remain = new TreeSet<>(); for (int i = 0; i < n; i++) { remain.add(i); } HashMap> used = new HashMap<>(); Query[] queries = new Query[q]; for (int i = 0; i < q; i++) { queries[i] = new Query(sc.nextInt() - 1, sc.nextInt() - 1, sc.nextInt()); } Arrays.sort(queries); for (Query x : queries) { Integer key = x.left; while ((key = remain.ceiling(key)) != null) { if (key > x.right) { break; } if (!used.containsKey(x.value)) { used.put(x.value, new TreeSet<>()); } used.get(x.value).add(key); ans[key] = x.value; remain.remove(key); } if (!used.containsKey(x.value)) { System.out.println(-1); return; } Integer next = used.get(x.value).ceiling(x.left); if (next == null || next > x.right) { System.out.println(-1); return; } } StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { if (i > 0) { sb.append(" "); } if (ans[i] == 0) { ans[i] = MAX; } sb.append(ans[i]); } System.out.println(sb); } static class Query implements Comparable { int left; int right; int value; public Query(int left, int right, int value) { this.left = left; this.right = right; this.value = value; } public int compareTo(Query another) { return another.value - value; } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }