We first solve the more general theorem:
Theorem For positive integers $k$ and $n$, there are a total of $kn$ balls labeled with numbers $1,2,\dots,n$, with $k$ balls for each number. The balls are put into $n$ boxes, with $k$ balls in each box. Then one ball can be chosen from each box such that the labels on each ball are $1,2,\dots,n$, in some order.
Proof. Notice that we essentially want a transversal of the boxes so we should try to apply Hall's Marriage Theorem. Notice that any collection of $l$ boxes contains $lk$ elements but any number appears at most $k$ times amongst these elements so in total there must be at least $l$ distinct elements, as desired.
Now to finish the problem we apply the theorem three times removing the transversal after each round. Then color the first two red and the last one blue.