What did this problem add?
Output the partition, not yes/no. The color array is the answer.
Competitive programming I/O: read from stdin, print to stdout.
Convert colors / to team labels / with +1.
Handle the impossible case explicitly with "IMPOSSIBLE".
Three problems, same algorithm. The framing changes, but the core bipartite detection stays constant. You now have a template that works across platforms.