Understanding test case for locked-in-gear puzzle


#1

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


#2

Did you try drawing it?


#3

gears

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.