10. Label the eight vertices of a cube with $1,2,3, \cdots, 8$ arbitrarily. If the two endpoints of an edge are $i$ and $j$, then the number marked on the edge is $|i-j|$. Let $S$ be the sum of the numbers on all edges. Find the minimum value of $S$.
10. Consider the maximum two numbers 7 and 8, these two numbers must be on two parallel planes (either up and down, front and back, or left and right). Let's assume 7 is on top and 8 is on the bottom. Now, consider the smallest two numbers 1 and 2.
(1) If 1 and 2 are also one on top and one on the bottom, for example, 1 is on top and 2 is on the bottom, then the four sides of the top square can form two loops of $1-7$, contributing 12 to $S$. The four sides of the bottom square can form two loops of $2-8$, also contributing 12 to $S$. There are also four vertical edges, so the total sum $S \geqslant 12 \times 2 + 4 = 28$. For cases where 1, 8 are on top and 2, 7 are on the bottom, and other similar situations, $S \geqslant 28$.
(2) If 1, 2, and 7 are all on the top, as shown in the figure, then $A B C$ is the $1-7$ path, and $D C$ is the $2-7$ path, contributing $6+5$ to $S$. There is still $A D$ uncounted. Projecting $A, B, C, D$ to the bottom, then $A A^{\prime} B^{\prime} C^{\prime}$ is the $1-8$ path, and $D D^{\prime} C^{\prime}$ is the $2-8$ path, contributing $7+6$ to $S$. There are still $A^{\prime} D^{\prime}, B B^{\prime}, C C^{\prime}$ uncounted, so $S \geqslant 6+5+7+6+4=28$. For other cases where 1, 2, and 7, 8 are on the same plane, it can also be proven that $S \geqslant 28$. The arrangement of numbers 5-8 as shown in the figure has $S=28$, hence $S_{\min }=28$.