(5) In space, there are 1989 points, no three of which are collinear. Divide them into 30 groups with different numbers of points. For any three different groups, take one point from each to form a triangle. Question: To maximize the total number of such triangles, how many points should each group have?
To divide 1989 points into 30 groups, let the number of points in each group be denoted as \( n_{1}, \cdots, n_{30} \). When taking one point from any three different groups to form a triangle, the total number of such triangles is given by \(\sum_{1 \leqslant i<j<k \leqslant 30} n_{i} n_{j} n_{k}\).

Since there are only a finite number of ways to divide the points, there must exist a division that maximizes the total number of triangles.

If we modify the number of points in two groups while keeping the others unchanged, let the new number of points in each group be \( n^{\prime}{ }_{1}, n^{\prime}{ }_{2}, \cdots, n^{\prime}{ }_{30} \), with \( n^{\prime}{ }_{i}=n_{i} \) for \( i=3,4, \cdots, 30 \). Given that \( n_{1}+n_{2}=n^{\prime}{ }_{1}+n^{\prime}{ }_{2} \), if

\[
\left|n^{\prime}{ }_{2}-n^{\prime}{ }_{1}\right| < \left|n_{2}-n_{1}\right|
\]

then

\[
\sum_{1 \leqslant i<j<k \leqslant 30} n_{i} n_{j} n_{k} < \sum_{1 \leqslant i<j<k \leqslant 30} n^{\prime}{ }_{i} n^{\prime}{ }_{j} n^{\prime}{ }_{k}
\]

Now, suppose the number of points in each group is \( n_{1}, \cdots, n_{30} \) such that the total number of triangles is maximized. Since the number of points in each group must be different, we can assume \( n_{1}<n_{2}<\cdots<n_{30} \). From the above, \( n_{1}, \cdots, n_{30} \) must have the following properties:
(1) For any \( k (1 \leqslant k \leqslant 29) \), \( n_{k+1}-n_{k} \leqslant 2 \).
If there exists some \( k_{0} \) such that \( n_{k_{0}+1}-n_{k_{0}} \geqslant 3 \), then taking \( n_{k_{0}}^{\prime}=n_{k_{0}}+1 \) and \( n_{k_{0}+1}^{\prime}=n_{k_{0}+1}-1 \) (with \( n_{i}^{\prime}=n_{i} \) for \( i \neq k_{0}, k_{0}+1 \)), i.e., moving one point from the \( (k_{0}+1) \)-th group to the \( k_{0} \)-th group, will indeed increase the total number of triangles.
(2) There is at most one \( k \) such that \( n_{k+1}-n_{k}=2 \).
If there are two \( i, j \) (assume \( 1 \leqslant i<j<29 \)) such that \( n_{i+1}-n_{i}=2 \) and \( n_{j+1}-n_{j}=2 \), then taking \( n_{j+1}^{\prime}=n_{j+1}-1 \) and \( n_{i}^{\prime}=n_{i+1} \) (with the number of points in other groups unchanged) will indeed increase the total number of triangles.
Since \(\sum_{i=1}^{30} n_{i}=1989\), it is impossible that
\[
n_{k+1}-n_{k}=1, \quad k=1,2, \cdots, 29
\]
(otherwise, these 30 numbers would form an arithmetic sequence, and their sum would be a multiple of 15, but \( 15 \times 1989 \)). Therefore, there is exactly one \( k_{0} \) such that \( n_{k_{0}+1}-n_{k_{0}}=2 \). These 30 numbers are
\[
n_{1}, n_{1}+1, \cdots, n_{1}+k_{0}-1, n_{1}+k_{0}+1, \cdots, n_{1}+30
\]

Thus,
\[
\begin{aligned}
1989+k_{0} &= \frac{1}{2} \cdot 30\left(n_{1}+1+n_{1}+30\right) \\
&= 15\left(2 n_{1}+31\right)
\end{aligned}
\]

Solving this, we get
\[
k_{0}=6, \quad n_{1}=51
\]

The required number of points in each group is \( 51, 52, \cdots, 56, 58, 59, \cdots, 81 \).

Note: This problem is essentially a proof question, and the existence of a division that maximizes the total number of triangles needs to be pointed out. Logically, the existence, necessary conditions, and the uniqueness of the solution that satisfies these conditions ensure that this is the division that maximizes the total number of triangles. Some students, in their arguments, used phrases like "when the number of points in each group is closer, the total number of triangles is larger." This statement is understandable in the case of two groups, but in the case of 30 groups, "the number of points in each group being closer" is a vague statement. This is something to avoid in logical arguments.