BFS on tree