U=The potential energy is given by:

To determine which mass has the greater potential energy we calculate the energy for each of them.
Mass of 2 kg at 12 m height:

Mass of 2 kg at 7 m height:

Mass of 4 kg at 5 m height:

From the energies we calculated we notice that the 2 kg mass at a height of 12 m has the largest potential energy, therefore the answer is A