Finished solver. Must check unsolvable case.