5.6. (Yugoslavia, 83). Find all values of $n \in \mathbf{N}$ that have the following property: if the numbers $n^{3}$ and $n^{4}$ are written next to each other (in the decimal system), then in the resulting record each of the 10 digits $0,1, \ldots, 9$ will appear exactly once.
5.6. Let $f(m)$ denote the number of digits in the decimal representation of the number $m \in N$, then for the desired number $n$ we have

$$
f\left(n^{3}\right)+f\left(n^{4}\right)=10
$$

Moreover, $f\left(n^{9}\right) \geqslant 4$, because otherwise the inequalities $n^{3}4$, then $n>10, n^{4}>10 n^{3}$, from which

$$
f\left(n^{3}\right) \geqslant 5, \quad f\left(n^{4}\right) \geqslant f\left(n^{3}\right)+1
$$

and

$$
f\left(n^{3}\right)+f\left(n^{4}\right) \geqslant 5+6>10
$$

Thus, $f\left(n^{9}\right)=4$ and $f\left(n^{4}\right)=6$. Further, from the inequality $n^{3}10000$. Similarly, from the inequality $n^{4} \geqslant 100000$ we have the estimate $n>17$, since $17^{4}<100000$. Therefore, $18 \leqslant n \leqslant 21$. Since any natural number is congruent modulo 9 to the sum of its digits, then

$$
n^{3}+n^{4} \equiv(0+1+\ldots+9)(\bmod 9)
$$

from which

$$
n^{3}(n+1)=0(\bmod 9) .
$$

The last condition is not satisfied by the values $n=19$ and $n=20$, and the value $n=21$ does not have the required property in the problem, since both numbers $21^{3}$ and $21^{4}$ end in the digit 1. Finally, checking shows that the only possible value $n=18$ satisfies the condition of the problem ( $18^{3}=5832,18^{4}=104976$ ).