Understanding test case for locked-in-gear puzzle


Can somebody explain output of the test case 5? How can it be “NOT MOVING”? I am stuck at this test case.


Did you try drawing it?



I got also stuck. But after drawing I figured out that my problem was that I stopped my BFS when finding the last one in the initial inputs which was wrong because you need to check if something breaks further down the line.


0 0 3
0 4 1
3 4 2

This test case says “NOT MOVING”

But all the gear touches


Draw this test case and you will see why the gears do not move (or try it with LEGO gears).