<s>[INST] Probability of selecting a ball from a box. Suppose we have $12$ identical balls. Think of the balls as having distinct ID numbers, $1-12$. We have $3$ identical boxes, each of which can contain exactly $4$ balls. One after the other the balls are thrown at random into one of the three boxes.
Suppose Mr. A will buy one ball from each box, so he will buy a total of three balls from the three boxes. Habit of Mr. A is to buy that ball from the box which ID is smallest of all other balls in that box.
For example, the randomly thrown balls in a box have ID $4$, $8$, $9$, and $12$. So Mr. A will buy the ball with ID $4$ from that box.
Then Mr. A goes to another box and here the balls have ID $1$, $3$, $6$, and $11$. He will buy the ball with ID $1$ from that box.
At last, Mr. A goes to the last box and here the balls have ID $2$, $5$, $7$, and $10$. He will buy the ball with ID $2$ from that box.
My question is:

What is the probability that Mr. A will buy the ball with ID $i$, where $i=1,2,\ldots,12$?

What I think is that we need to consider the following two things to calculate the probability:

$(1)$ the position of a ball in the box. Mr. A will buy the ball with ID number $2$ if and only if the box does not contain the ball with ID number $1$.
$(2)$ If Mr. A buy a ball with smallest ID from the first box in front of him, then are there $11$ balls remaining to buy another two balls or are there $8$ balls (excluding all $4$ balls from the first box)?

 [/INST] For $1\lt j\lt k$, there are $3!\binom{12-k}{3}\binom{8-j}{3}$ ways to buy $1,j,k$.
$3!$ due to the arrangements of $1,j,k$. $\binom{12-k}{3}$ due to the number of ways to choose $3$ balls greater than $k$. $\binom{8-j}{3}$ due to the number of ways to choose $3$ balls greater than $j$ from those left over from choosing $3$ greater than $k$.
The number of ways for $n$ to be the greatest is
$$
\begin{align}
3!\binom{12-n}{3}\sum_{j=2}^{n-1}\binom{8-j}{3}
&=3!\binom{12-n}{3}\left[\binom{7}{4}-\binom{9-n}{4}\right]\\
&=3!\binom{7}{4}\binom{12-n}{3}-3!\binom{7}{4}\binom{12-n}{7}
\end{align}
$$
The number of ways for $n$ to be the middle is
$$
\begin{align}
3!\binom{8-n}{3}\sum_{k=n+1}^9\binom{12-k}{3}
&=3!\binom{8-n}{3}\binom{12-n}{4}\\
&=3!\binom{7}{4}\binom{12-n}{7}
\end{align}
$$
Since the total number of arrangements is $\frac{12!}{(4!)^3}$, and $\frac{3!\binom{7}{4}}{\frac{12!}{(4!)^3}}=\frac1{165}$, the probability of buying the ball labeled $n$ would be
$$
p(n)=\frac1{165}\binom{12-n}{3}
$$
</s>