bfs dfs and output