Solver to the n-dames problems