RMQ in reverse#5204

RMQ in reverse

1 second
64 megabytes
Very hard

Let's consider an array a_1, a_2, \ldots, a_n. Define Q(i, j) as the minimum value among the elements a_i, a_{i+1}, \ldots, a_j.

You are given several queries and their corresponding answers. Your task is to reconstruct the original array.

Input

The first line contains two integers and (1 \leq n, m \leq 100000): the size of the array and the number of queries. Each of the following lines contains three integers , , , denoting that Q(i, j) = q (1 \leq i \leq j \leq n, -2^{31} \leq q \leq 2^{31} - 1).

Output

If it is impossible to reconstruct the array, output inconsistent. Otherwise, output consistent in the first line, and in the second line print the array elements. All array elements must be integers in the range [-2^{31}, 2^{31} - 1]. If multiple solutions exist, output any of them.

Examples

Example 1

Loading
Loading