I was a bit confused at first, but it's a clever mechanic !
It's pretty hard though ! It's not easy to imagine how the movement will end to so at one point I kinda bruteforced the solution without thinking too much