Repeating merge-and-average until one cluster remains gives the full UPGMA tree.
highlighted = computed this step
Repeat merge and average
After each merge, UPGMA averages distances to the new cluster and looks for the next closest pair. Repeating that process to the end leaves one rooted tree.
merge, average, repeat
The merge order becomes the tree
W and X join at height 1; that cluster joins Y at height 2; then Z joins at height 3.