5. Given $a_{1}, a_{2}, \cdots, a_{10}$ and $b_{1}, b_{2}, \cdots, b_{10}$ are permutations of $1,2, \cdots, 10$, i.e., the sets
$$
\begin{array}{l}
\left\{a_{1}, a_{2}, \cdots, a_{10}\right\} \\
=\left\{b_{1}, b_{2}, \cdots, b_{10}\right\} \\
=\{1,2, \cdots, 10\} .
\end{array}
$$

Let $c_{k}=a_{k}^{2}+b_{k}^{2}(k=1,2, \cdots, 10)$. Suppose the maximum value of $c_{1}$, $c_{2}, \cdots, c_{10}$ is $M$, and the minimum value is $m$. Find
(1) the smallest possible value of $M$;
(2) the largest possible value of $m$.
(Wang Bin, problem contributor)
5. Let $a_{k}=k, b_{k}=11-a_{k}=11-k$, i.e., $b_{1}$, $b_{2}, \cdots, b_{10}$ are exactly in reverse order of $a_{1}, a_{2}, \cdots, a_{10}$, at this time, the sequence
$$
c_{k}=a_{k}^{2}+b_{k}^{2}=k^{2}+(11-k)^{2}
$$

has the maximum number $M=c_{1}=c_{10}=1^{2}+10^{2}=101$, reaching its minimum possible value; the minimum number $m=c_{5}=c_{6}=5^{2}+6^{2}=$ 61, reaching its maximum possible value.

For any two permutations $a_{1}, a_{2}, \cdots, a_{10}$ and $b_{1}, b_{2}, \cdots, b_{10}$ in the problem, we will prove next: $c_{k}=a_{k}^{2}+b_{k}^{2}$ $(k=1,2, \cdots, 10)$ contains at least one number not less than 101, and at least one number not more than 61.

On one hand, among $a_{1}, a_{2}, \cdots, a_{10}$, there is a number equal to 10, without loss of generality, let $a_{10}=10$, at this time,
$$
b_{10} \geqslant 1, c_{10}=a_{10}^{2}+b_{10}^{2} \geqslant 101 .
$$

On the other hand, consider the numbers $1,2, \cdots, 6$ appearing in $a_{1}, a_{2}, \cdots, a_{10}$ and the numbers $1,2, \cdots, 5$ appearing in $b_{1}, b_{2}, \cdots, b_{10}$, these 11 numbers must meet in some addition formula $c_{k}=a_{k}^{2}+b_{k}^{2}$ (by the pigeonhole principle, we know there are 10 addition formulas), at this time,
$$
c_{k}=a_{k}^{2}+b_{k}^{2} \leqslant 6^{2}+5^{2}=61 .
$$