A rectangular container, whose base is a square of side 5 cm, stands on a horizontal table, and holds water upto 1 cm from the top. When a cube is placed in the water it is completely submerged, the water rises to the top and 2 cubic cm of water overflows. Calculate the volume of the cube and also the length of its edge.