import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int q = sc.nextInt(); 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); TreeSet all = new TreeSet<>(); for (int i = 0; i < n; i++) { all.add(i); } int[] ans = new int[n]; Arrays.fill(ans, 1000000000); TreeSet store = new TreeSet<>(); int prev = Integer.MAX_VALUE; for (Query x : queries) { if (prev != x.value) { store.clear(); } Integer key = store.floor(x.right); boolean enable = (key != null && key >= x.left); ArrayList list = new ArrayList<>(); key = x.left - 1; while ((key = all.higher(key)) != null) { if (key > x.right) { break; } all.remove(key); list.add(key); } if (!enable && list.size() == 0) { System.out.println(-1); return; } for (int y : list) { ans[y] = x.value; store.add(y); } prev = x.value; } System.out.println(String.join(" ", Arrays.stream(ans).mapToObj(String::valueOf).toArray(String[]::new))); } 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 Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }