a bfs search problem