backtracking works :D