시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB222100.000%

문제

A building company wants to build $n$ houses on a new street. Due to requirements of increasing diversity of the city skyline, all houses must have different heights from $1$ to $n$ floors. Moreover, there are $m$ additional restrictions on minimum height of buildings on certain intervals of the street. Due to importance of the new street, city administration is ready to cancel one of the restrictions. Determine whether it is possible to create a plan for the new street under the given constraints.

입력

The first line contains two integers: the length of the street $n$ and the number of height restrictions $m$ ($2 \le n \le 3 \cdot 10^5$, $1 \le m \le 3 \cdot 10^5$).

The next $m$ lines contain restrictions. Each restriction is described by three integers $h$, $s$, and $f$ which mean that houses from $s$ to $f$ inclusively must have height at least $h$ ($2 \le h \le n$, $1 \le s \le f \le n$).

출력

If it is not possible to create a street plan, print "NO" on a single line.

Otherwise, on the first line, print "YES". On the second line, print a street plan consisting of $n$ house heights. The plan must satisfy all restrictions except possibly one. If there are several possible plans, print any one of them.

예제 입력 1

2 2
2 1 1
2 1 2

예제 출력 1

YES
2 1

예제 입력 2

3 2
2 1 2
2 2 3

예제 출력 2

YES
1 3 2

예제 입력 3

4 2
4 1 2
3 2 4

예제 출력 3

NO