Split the Attractions
문제
There are attractions in Baku, numbered from to . There are also two-way roads, numbered from to . Each road connects two different attractions. It is possible to travel between any pair of attractions through the roads.
Fatima is planning to visit all of the attractions in three days. She already decided that she wants to visit attractions on the first day, attractions on the second day, and attractions on the third day. Therefore, she is going to partition the attractions into three sets , , and of sizes , , and , respectively. Each attraction will belong to exactly one set, so .
Fatima would like to find the sets , , and , so that at least two out of the three sets are connected. A set of attractions is called connected if it is possible to travel between any pair of attractions in by using the roads and without passing through any attraction not in . A partition of attractions into sets , , and is called valid if it satisfies the conditions described above.
Help Fatima find a valid partition of the attractions (given , , and ), or determine that no valid partition exists. If there are multiple valid partitions, you may find any of them.