The correct answer is:
Cl; it takes much more energy to pull an electron away from a valence shell that is nearly full.
Chlorine has a higher ionization energy than magnesium because chlorine has seven valence electrons and is one electron short of a full octet, making it energetically favorable to retain those electrons. In contrast, magnesium has two valence electrons which it can lose more easily to achieve a stable electron configuration. Thus, it requires more energy to remove an electron from chlorine than from magnesium.