Solver for the missionaries and cannibals riddle