monocarp tree consist n vertex root vertex 1 he decide study BFS Breadthfirst search run BFS tree start root BFS describe follow pseudocodea order vertice processedq Queueqput1 place root end queuewhile qempty k qpop retrieve vertex queue aappendk append k end sequence vertex visit y gk gk list child vertex k sorted ascending order qputyMonocarp fascinated BFS end lose tree fortunately sequence vertex order vertex visit BFS algorithm array pseudocode Monocarp know vertex visit exactly take queue exactly also know child vertex view ascending ordermonocarp know tree general case visit order do not hope restore tree Monocarp okay tree minimum heightthe height tree maximum depth tree vertex depth vertex number edge path root for example depth vertex 1 0 root depth root child 1help Monocarp find tree give visit order minimum height