This problem may not have the answer that comes to the mind at a first glance. Take your time and try to think out of the box.
-----------book page break-----------
To be able to solve this problem we might have to examine a couple of possible paths.
We know that the shortest distance between any two points is the straight line joining the two points on a plane.
In this case however, you cannot join the two points as the line will pass through space, and the ant cannot take that path.
So let us try to bring the two points on a single plane such that the ant can actually take that path.
Let us start by naming the vertices as shown in the figure below:
-----------book page break-----------
Now let us assume that the sides of the box are made of double layered material and can be unfolded along any edge of your choice. We can open the box as illustrated in the diagram below:
This way the two points $P$ and $Q$ are on the same plane and is a possible path for the ant.
And we get the length of the path as:
$5 + 12 + 24 + (12 - 10) = 43\ cm$
-----------book page break-----------
But there is one more possible path if we open the sides as shown in the following diagram:
To be able to find out the length of the paths in this case, let us consider $\triangle PMR$ and $\triangle QNR$
$\angle MRP = \angle NRQ$ $(vertically\ opposite\ angles)$ and $\angle PMR = \angle QNR$ (both $90^\circ$), therefore the thirds angles $\angle MPR$ and $\angle NQR$ are also equal.