#d2842. 排队
排队
Line Up
Problem Description
Determine whether there is a way to arrange the people numbered from to in a single line, such that given requirements are all satisfied.
Each requirement gives two integers and , meaning that person and person must be adjacent.
It is guaranteed that all requirements are distinct — for example, once is given, neither nor will be given again.
Input Format
The first line contains two integers and , the number of people and the number of requirements.
Output Format
If there is a way to line these people up in a row satisfying all conditions, output Yes; otherwise output No.
Sample Input 1
4 2
1 3
2 3
Sample Output 1
Yes
Sample Input 2
4 3
1 4
2 4
3 4
Sample Output 2
No
Sample Input 3
3 3
1 2
1 3
2 3
Sample Output 3
No
Constraints
For all data: , , .