#abc231d. [abc231_d]Neighbors
[abc231_d]Neighbors
Problem Statement
Determine whether there is a way to line up people, numbered to , in a row side by side to satisfy all of the conditions in the following format.
- Condition: Person and Person are adjacent.
Constraints
- All pairs are distinct.
Input
Input is given from Standard Input in the following format:
Output
If there is a way to line up people to satisfy the conditions, print Yes
; if not, print No
.
Sample Input 1
4 2
1 3
2 3
Sample Output 1
Yes
One way to satisfy all the conditions is to line them up in the order .
Sample Input 2
4 3
1 4
2 4
3 4
Sample Output 2
No
There is no way to line them up to satisfy all the conditions.