Solver for Missionary and Cannible problem