finished simple backtracking