Cannibals and missionaries solver