6. Let $x_{i} \in\{1,2, \cdots, n\}, i=1,2, \cdots, n$, satisfy $\sum_{i=1}^{n} x_{i}=\frac{n(n+1)}{2}, x_{1} x_{2} \cdots x_{n}=n$ !, the maximum number $n$ for which $x_{1}, x_{2}, \cdots, x_{n}$ must be a permutation of $1,2, \cdots, n$ is ( ).
(A) 4
(B) 6
(C) 8
(D) 9
6. (C).

When $n \geqslant 9$, $9, 4, 4$ can replace the factors 8, 6, 3 in $n$!, since $8+6+3=9+4+4$ and $8 \times 6 \times 3=9 \times 4 \times 4$. Thus, the sum $x_{1}+x_{2}+\cdots+x_{n}$ and the product $x_{1} x_{2} \cdots x_{n}$ remain unchanged. However, when $n=8$, it is known that $x_{1}, x_{2}, \cdots, x_{8}$ is indeed a permutation of $1, 2, \cdots, 8$.