Add a slightly different solution for tree BFS traversal.