398. In a regular $n$-gon, it is required to paint each side and each diagonal with some color so that any two of these segments, having a common point, are painted differently. What is the minimum number of colors needed for this?
398. Answer: $n$ colors. Let $A, B$ and $C$ be three consecutive vertices. Any two of the $n$ segments: $B A, B C, A C$ and $n-3$ diagonals emanating from $B$, have a common point. Next, paint in one of $n$ colors all sides and diagonals forming with side $A B$ the same angle $\frac{k \cdot 180^{\circ}}{n}$ for $k=0,1,2, \ldots, n-1$.