At the beginning of a race, the order of cars from front to back is
An overtake can happen only when two cars are adjacent. The car behind moves in front of the other car, so the two cars swap positions. Moreover, every pair of cars passes each other at most once.
A camera recorded all overtakes, but their timestamps were lost. Each report states that car overtook car .
Determine whether the reports can be arranged in a chronological order such that exactly these overtakes could have happened. If they can, also find the order of the cars from front to back at the end of the race.
For each test case, print No if the reports cannot all be realized.
Otherwise, print Yes on the first line. On the second line, print a permutation : the order of the cars from front to back after all reported overtakes.
The words Yes and No are case-insensitive. For example, YES, yes, and yEs are all accepted.
With only one car and no reports, the final order remains .
The reports require car to finish in front of car , and car to finish in front of car . However, cars and did not pass each other, so car would have to remain in front of car . These requirements are contradictory.
The overtakes can happen in the order , , and . The resulting order is .
One possible chronological order of the reports is , , , and . The cars then finish in the order .