Repeating the merge rule builds the full code tree.
Repeat the same rule
After CD exists, the queue is A, B, and CD. The same smallest-first rule continues.
repeat smallest-first
B merges with CD
B has count 2, and CD has count 2. The lexical tie puts B first, making BCD with count 4.
B+CD=BCD,∣BCD∣=4
The last merge makes root
BCD has count 4. A has count 5. Together they make the root with total 9.
Summary
The merge order is C with D, then B with CD, then BCD with A.
merge order is fixed