We have three cube-shaped containers. The edge of the second cube is $4 \mathrm{~cm}$ shorter than the edge of the first cube, and the edge of the third cube is $2 \mathrm{~cm}$ shorter than the edge of the second cube. We fill the second container from the first one, which is filled with water, and then we fill the third container from the second one. This way, the first container has $40 \mathrm{~cm}^{3}$ more water than three times the content of the second container. What is the volume of the three containers?