RMQ in reverse
Let's consider an array (a[1..n]). Define (Q(i, j)) as the result of the query that finds the minimum value among the elements (a[i], ..., a[j]).
You are provided with several queries and their corresponding answers. Your task is to reconstruct the original array.
Input
The first line of the input contains two integers: (n), the size of the array, and (m), the number of queries ((1 n, m 100000)). The following (m) lines each contain three integers (i), (j), and (q), indicating that (Q(i, j) = q) ((1 i j n), (-2^31 q 2^31-1)).
Output
If it is impossible to reconstruct the array, output the line inconsistent. Otherwise, print consistent on the first line. On the second line, output the elements of the array. The elements must be integers within the range ([-2^31, 2^31-1]). If multiple solutions exist, you may output any one of them.