Easy Compare-and-Set
문제
Let us define "Compare-and-Set" operation for a global variable . The operation checks if the variable is equal to . If that's true, the variable value changes to and the operation succeeds. Otherwise, the variable doesn't change and the operation fails. Let us denote the operation as .
Imagine that you are given a list of such operations . Also, you are given an initial value for the variable, , and a list of wishes , where tells whether the operation should be successful. Your task is to determine the order of operations execution so that all the wishes are satisfied.
입력
The first line contains two integers and (; ) --- the number of operations and the initial value of the variable.
Each of the next lines contains three integers (; ), denoting operation that you wish to be successful if and unsuccessful if . The operations are numbered from to in order of input.
출력
If no correct order of operations exists, output a single word "No".
Otherwise, output a word "Yes" followed by distinct integers (), meaning that operation should be executed first, then operation , and so on. If there are several possible orders, output any of them.
예제
예제 1
4 1 1 2 0 1 2 1 2 3 1 3 4 0
Yes 4 2 1 3
예제 2
3 1 1 2 1 1 2 1 1 2 0
No