Cute BFS and DFS