Working breadth first with backtracking