DFS and BFS working