search with backtracking