partially implemented backtracking