AT_abc478_e [ABC478E] lt and le
Description
Determine whether there exists an integer sequence $ A $ of length $ N $ consisting of integers between $ 1 $ and $ N $ , inclusive, that satisfies all of the following $ Q $ conditions, and if it exists, find one.
The $ i $ -th condition $ (1\le i\le Q) $ is given by a triple of integers $ (t _ i,u _ i,v _ i) $ , and is defined as follows.
- If $ t _ i=0 $ : $ A _ {u _ i}\le A _ {v _ i} $
- If $ t _ i=1 $ : $ A _ {u _ i}\lt A _ {v _ i} $
If there are multiple sequences satisfying all conditions, you may output any of them.
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ Q $ $ t _ 1 $ $ u _ 1 $ $ v _ 1 $ $ t _ 2 $ $ u _ 2 $ $ v _ 2 $ $ \vdots $ $ t _ Q $ $ u _ Q $ $ v _ Q $
Output Format
On the first line, output `Yes` if an integer sequence satisfying the conditions exists, and `No` otherwise. If you output `Yes` on the first line, choose one integer sequence satisfying the conditions and output its elements, separated by spaces, on the second line. If there are multiple sequences satisfying all conditions, you may choose any of them.
Explanation/Hint
### Sample Explanation 1
Let $ A=(1,4,2,1,3,5,6) $ ; this is an integer sequence of length $ 7 $ consisting of integers between $ 1 $ and $ 7 $ , inclusive. Here, for example, the first condition $ A _ 1\le A _ 4 $ holds since $ 1\le 1 $ . The other seven conditions also hold, so the output corresponding to $ A=(1,4,2,1,3,5,6) $ is considered correct.
Additionally, $ A=(1,1,1,1,2,2,3) $ , $ A=(3,5,4,3,6,7,7) $ , and others also satisfy the conditions, so outputting these is also considered correct.
### Sample Explanation 2
There is no integer sequence $ A $ such that $ A _ 1\lt A _ 1 $ holds.
### Constraints
- $ 1\le N\le2\times10 ^ 5 $
- $ 1\le Q\le2\times10 ^ 5 $
- $ t _ i\in\lbrace0,1\rbrace\ (1\le i\le Q) $
- $ 1\le u _ i\le N\ (1\le i\le Q) $
- $ 1\le v _ i\le N\ (1\le i\le Q) $
- All input values are integers.