Solution (source code)

= Solution

There are $6^3=216$ unrestricted placements, since one colour has $\binom42=6$ occupancy vectors. For any specified empty box, the two remaining boxes admit $3^3=27$ placements. For any specified pair of empty boxes, the one remaining box admits one placement. All three boxes cannot be empty.

The <inclusion-exclusion principle> therefore gives
$$
\boxed{216-3(27)+\binom32(1)=138.}
$$
The empty-box events are not <disjoint events>, so subtracting their counts without restoring their pairwise overlaps would be incorrect.