287 传统题

[ABC291E] 唯一排列判定 (Find Permutation)

时间限制
2000ms
内存限制
256MiB
登顶 / 尝试
0/ 0
难度
3

[ABC291E] 唯一排列判定 (Find Permutation)

Problem Statement

There is a length-NN sequence A=(A1,…,AN)A=(A_1,\ldots,A_N) that is a permutation of 1,…,N1,\ldots,N.

While you do not know AA, you know that AXi<AYiA_{X_i}<A_{Y_i} for MM pairs of integers (Xi,Yi)(X_i,Y_i).

Can AA be uniquely determined? If it is possible, find AA.

Input

The input is given from Standard Input in the following format:

$N$ $M$
$X_1$ $Y_1$
$\vdots$
$X_M$ $Y_M$

Output

If AA can be uniquely determined, print Yes in the first line. Then, print A1,…,ANA_1,\ldots,A_N in the second line, separated by spaces.

If AA cannot be uniquely determined, just print No.

Example

3 2
3 1
2 3
Yes
3 1 2

Note

  • Constraints:

  • 2≤N≤2×1052 \leq N \leq 2\times 10^5

  • 1≤M≤2×1051 \leq M \leq 2\times 10^5

  • 1≤Xi,Yi≤N1\leq X_i,Y_i \leq N

  • All values in the input are integers.

  • There is an AA consistent with the input.

  • Source: ABC291E