[Community Puzzle] Squares order

Hey,
About Squares order, I have a problem I cannot solve.
I wrote a solution that I believe is correct and it passes all the test cases inside the Coding Game IDE.
But when I submit my solution, the 4th validation test case fails. I probably poorly handle some particular case in my code, but I cannot figure what it is, and of course, we don’t have access to the validation test case, so that won’t help.
Does someone have an idea ?