9. (16 points) Find all positive integers $n$ such that the set $M=\{1,2, \cdots, 4 n\}$ can be partitioned into $n$ four-element subsets: $M=\bigcup_{k=1}^{n} M_{k}$, where each subset $M_{k}=\left\{a_{k}, b_{k}, c_{k}, d_{k}\right\}$ $(k=1,2, \cdots, n)$ contains one element that is the arithmetic mean of the other three.
Sure, here is the translated text:

```
9. Let's assume in the subset $M_{k}$,
$$
d_{k}=\frac{a_{k}+b_{k}+c_{k}}{3} \text {. }
$$

Then $a_{k}+b_{k}+c_{k}+d_{k}=4 d_{k}$.
Thus, $4 \sum_{i=1}^{n} d_{i}=\sum_{k=1}^{4 n} k=\frac{4 n(4 n+1)}{2}$.
Therefore, $21 n$.
When $2 \mid n$, the set $M$ has a partition that satisfies the condition, let $n=2 m$.
$$
\begin{array}{l}
\text { Then } M=\{1,2, \cdots, 8 m\}=\bigcup_{k=0}^{m-1}\left(M_{k} \cup M_{k}^{\prime}\right), \\
M_{k}=\{8 k+1,8 k+3,8 k+8,8 k+4\}, \\
M_{k}^{\prime}=\{8 k+2,8 k+6,8 k+7,8 k+5\} .
\end{array}
$$
```