problem 3 dfs bfs