The ant is a mathematical metaphor - a point that can trace a path along any surface and can cross to another surface only by crossing an edge, but cannot leave the surface.
It’s not hard to imagine a 2d square sliding across a 3d surface or a line traveling across a 2d plane so an ant travelling across a 4d surface is not that weird.
Four dimensional? That is a tesseract. This is impossible to describe how an ant would even interact with let alone touch all eight cells only once.
Once done with the first cube, the ant takes a gondola, going along the 4th dimension and repeats the walk he did on the first cube.
The ant is a mathematical metaphor - a point that can trace a path along any surface and can cross to another surface only by crossing an edge, but cannot leave the surface.
It’s not hard to imagine a 2d square sliding across a 3d surface or a line traveling across a 2d plane so an ant travelling across a 4d surface is not that weird.