# A problem on combinatorics, boxes and dispositions

I am struggling with the following problem / riddle, which reads:

A tea merchant has five tin tea boxes of cubical shape, which he keeps on his counter in a row. Every box has a picture on each of its six sides, so there are thirty pictures in all; but one picture on No. $1$ is repeated on No. $4$, and two other pictures on No. $4$ are repeated on No. $3$. There are, therefore, only twenty-seven different pictures. The owner always keeps No. $1$ at one end of the row, and never allows Nos. $3$ and $5$ to be put side by side.

The tradesman's customer, having obtained this information, thinks it a good puzzle to work out in how many ways the boxes may be arranged on the counter so that the order of the five pictures in front shall never be twice alike. Of course, two similar pictures may be in a row, as it is all a question of their order.

So here is my attempt:

If all the figures on the boxes were different, then we'd have $30$ different pictures, but due to the condition above, we only have $27$ different figures on the boxes.

Now, the other condition is Box $1$ at the end, and $3$ and $5$ never near, which leaves the total combinations (orders) of the boxes to twelve:

$1-2-3-4-5$

$1-3-2-4-5$

$1-3-4-2-5$

$1-3-2-5-4$

$1-3-4-5-2$

$1-4-3-2-5$

Plus the symmetry of the exchange $5\to 3$

So I have $12$ possible dispositions of the boxes.

Now, let's call the figures on each box as

$$1 = \{A_1, A_2, A_3, A_4, A_5, A_6\}$$ $$2 = \{B_1, \ldots, B_6\}$$ $$3 = \{C_1 \ldots C_6\}$$ $$4 = \{D_1, D_2, D_3, A_1, C_1, C_2\}$$ $$5 = \{E_1 \ldots E_6\}$$