Split the Attractions
Time limit2sMemory limit1024 MB
Partition the vertices of a connected graph into sets of sizes a, b, and c so that at least two of the sets are connected.
Problem
There are attractions in Baku, numbered from to . There are also two-way roads, numbered from to . Each road connects two different attractions. Any pair of attractions can be reached from each other through the roads.
Fatima plans to visit all of the attractions in three days. She wants to visit attractions on the first day, on the second day, and on the third day. She will partition the attractions into three sets , , and of sizes , , and . Each attraction belongs to exactly one set, so .
A set of attractions is connected if any two attractions in can reach each other by roads without passing through an attraction outside . Find sets , , and so that at least two of the three sets are connected. A partition that meets this condition is valid.
Given , , and , find a valid partition, or determine that no valid partition exists. If several valid partitions exist, you may output any of them.
Constraints
- There is at most one road between each pair of attractions.
- Any pair of attractions can be reached from each other through the roads.
- and for