SPOJ-MAWORK

Hi

I am trying to solve the problem Men at Work. It can be solved using BFS. However I am unable to come up with the BFS state. Any help is really appreciated.

Thanks