import java.io.*;
import java.util.*;

public class rmq_as implements Runnable {
    BufferedReader in;
    StringTokenizer st;

    int nextInt() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {
            }
        }
        return Integer.parseInt(st.nextToken());
    }

    class Event implements Comparable<Event> {
        int p;
        int v;
        int i;
        boolean start;
        Event r;

        Event(int p, int v, int i, boolean start) {
            this.p = p;
            this.v = v;
            this.i = i;
            this.start = start;
        }

        public int compareTo(Event o) {
            if (p != o.p) {
                return p - o.p;
            } else {
                return start && !o.start ? -1 : o.start && !start ? 1 : i - o.i;
            }
        }
    }

    public void solve() throws IOException {
        in = new BufferedReader(new FileReader("rmq.in"));
        PrintWriter out = new PrintWriter(new File("rmq.out"));

        int n = nextInt();
        int m = nextInt();

        long time = System.currentTimeMillis();
        int[] a = new int[n];
        Event[] e = new Event[2 * m];
        for (int i = 0; i < m; i++) {
            int l = nextInt() - 1;
            int r = nextInt() - 1;
            int v = nextInt();
            e[2 * i] = new Event(l, v, i, true);
            e[2 * i + 1] = new Event(r, v, i, false);
            e[2 * i].r = e[2 * i + 1];
            e[2 * i + 1].r = e[2 * i];
        }
        time = System.currentTimeMillis() - time;
        System.out.println(time);
        time = System.currentTimeMillis();

        Arrays.sort(e);

        time = System.currentTimeMillis() - time;
        System.out.println(time);
        time = System.currentTimeMillis();

        SortedSet<Event> open = new TreeSet<Event>(new Comparator<Event>() {
            public int compare(Event o1, Event o2) {
                return o1.v < o2.v ? -1 : o1.v > o2.v ? 1 : o1.i - o2.i;
            }
        });
        int p = 0;
        for (int i = 0; i < n; i++) {
            while (p < 2 * m && e[p].start && e[p].p == i) {
                open.add(e[p]);
                p++;
            }
            a[i] = 0;
            if (open.size() > 0) {
                a[i] = open.last().v;
            }
            while (p < 2 * m && !e[p].start && e[p].p == i) {
                open.remove(e[p].r);
                p++;
            }
        }
        time = System.currentTimeMillis() - time;
        System.out.println(time);
        time = System.currentTimeMillis();

        int s = 1;
        while (s < n) {
            s *= 2;
        }
        int[] b = new int[2 * s];
        for (int i = 0; i < n; i++) {
            b[s + i] = a[i];
        }
        for (int i = s - 1; i >= 1; i--) {
            b[i] = Math.min(b[2 * i], b[2 * i + 1]);
        }

        time = System.currentTimeMillis() - time;
        System.out.println(time);
        time = System.currentTimeMillis();

        boolean ok = true;
        for (int i = 0; i < 2 * m; i++) {
            if (e[i].start) {
                int l = e[i].p + s;
                int r = e[i].r.p + s;
                int min = Integer.MAX_VALUE;
                while (l <= r) {
                    if (b[l] < min) {
                        min = b[l];
                    }
                    l = (l + 1) / 2;
                    if (b[r] < min) {
                        min = b[r];
                    }
                    r = (r - 1) / 2;
                }
                if (min != e[i].v) {
                    ok = false;
                    break;
                }
            }
        }

        time = System.currentTimeMillis() - time;
        System.out.println(time);
        time = System.currentTimeMillis();

        if (ok) {
            out.println("consistent");
            for (int i = 0; i < n; i++) {
                out.print(a[i] + " ");
            }
            out.println();
        } else {
            out.println("inconsistent");
        }
        time = System.currentTimeMillis() - time;
        System.out.println(time);
        time = System.currentTimeMillis();


        in.close();
        out.close();
    }

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            System.exit(64);
        }
    }

    public static void main(String[] arg) throws IOException {
        new Thread(new rmq_as()).start();
    }
}
