Split into Two Teams
Each pair u v means members and must be on different teams. Can all members be split into two teams following every rule? Print Yes or No. (Is the graph bipartite?)
Input
and , then lines u v.
Output
Yes or No.
Constraints
,
Sample 1
Input
4 4 1 2 2 3 3 4 4 1
Output
Yes
Sample 2
Input
3 3 1 2 2 3 3 1
Output
No