Modify path find BFS