I didn't understand why the method mentioned in the editorial works. Can someone provide me with a proof for why it works?
Question : 357B
Editorial Solution :
Let's process the dances in the given order and determine the colors of dancers' clothes. If there are no dancer from some previous dance, we can give the dances different colors arbitrarily. And if there is such dancer, we already know the color of his clothes. So, we arbitrarily distribute the other two colors between the remaining two dancers.