Problem C
Cable Car
At
Two companies, Mobi and Vina are in charge of operating
cable cars connecting the stations. Each of the two companies
have
Two stations are called connected by a company, iff we can go from one station to the other by using cable cars only of that company. To achieve peaceful cooperation, the two companies agreed with the following conditions:
-
For every valid
, and . -
All
are unique, all are unique. -
All
are unique, all are unique. -
For any
, if , then . -
For any
, if , then . -
No pair of stations is connected by both companies. In other words, for every pair of stations
and , if and are connected by Mobi, they should not be connected by Vina, and vice versa.
Given
Input
The input contains two integers
Output
For each test case, if it is not possible to satisfy all the
conditions, print ‘NO’. Otherwise, print ‘YES’, followed by
Sample Input 1 | Sample Output 1 |
---|---|
3 1 |
YES 1 2 1 3 |
Sample Input 2 | Sample Output 2 |
---|---|
3 2 |
NO |