Three mothers A, B, C, along with their children a, b, c, are on the one side of the river, and need to get to the other side, using only one boat, which can hold one or two people. The catch is that any of the children a, b, or c, if left alone (i.e. without his mother in the presence of another mother) will be killed. That is, a mother should always be with her child in the presence of other mothers, in order to protect it.
How do you get everyone safely on the other side?
State of affairs on two river sides Action taken
----------------------------------- ------------
{A,a,B,b,C,c} {.} a,b -->
{A,B,C,c} {a,b} <-- b
{A,B,b,C,c} {a} b,c -->
{A,B,C} {a,b,c} <-- b
{A,B,b,C} {a,c} A,C -->
{B,b} {A,a,C,c} <-- A,a
{A,a,B,b} {C,c} A,B -->
{a,b} {A,B,C,c} <-- c
{a,b,c} {A,B,C} b,c -->
{a} {A,B,b,C,c} <-- A
{A,a} {B,b,C,c} A,a -->
{.} {A,a,B,b,C,c}