Never figured out how the exchanging worked, but I made it to the end anyway.
I should have draw the graph of the exchange, but I am so late for the submission so I couldn't make some simple case level and put in a very big level. Thanks for playing !