In a school, there are pupils and friendships.
Your task is to divide the pupils into two teams so that no friends are in the same team. If possible, print the team number ( or ) for each pupil. If impossible, print "IMPOSSIBLE". This is the same bipartite detection, but now you must output the actual partition, not yes/no. Before reading on, think: how do you produce the output?
What do the colors represent?