Three people, Ann, Ben and Jen want to cross a river from left bank to right bank. Another three people, Tim, Jim and Kim want to cross the same river from right bank to left bank.
However, there is no boat and only one stone bridge consisting of just seven big stones (not tied to each other), each of which can hold only 1 person at a time. All these people have a limited jumping capacity, so that they can only jump to the stone immediately next to them if it is empty.
Now, all of these people are quite arrogant and so will never turn back once they have begun their journey. That is, they can only move forward in the direction of their destination. They are also quite selfish and will not help anybody travelling in the same direction as themselves.
But they are also practical and know that they will not be able to cross without helping each other. Each of them is willing to help a person coming from opposite direction so that they can get a path for their own journey ahead. With this help, a person can jump two stones at a time, such that if, say, Ann and Tim are occupying two adjacent stones and the stone next to Tim on the other side is empty, then Tim will help Ann in directly jumping to that stone, and vice versa.
Now initially the six people are lined up on the seven stones from left to right as follows:
Ann Ben Jen empty Tim Jim Kim
Your job is to find how they will cross over the stones such that they are finally lined up as follows:
Tim Jim Kim empty Ann Ben Jen
Now, find out the shortest step-wise procedure, assuming that Tim moves first.