Deformation of nuclei close to the two-neutron drip line in the Mg region