A magic cube is a number of integers arranged in a $n\times n\times n$ pattern such that the sum of the numbers on each row, each column, each pillar and the four main space diagonals is equal to a single number, the so-called magic constant of the cube.
Construct a $3\times3\times3$ magic cube with numbers $1, 2, \dots, 3^3$.