bfs and dfs are working