simple backtracking.