Path recursion in BFS