The correct order of electron gain enthalpy (from most to least endothermic) is:
Electron gain enthalpy is a quantitative measurement of the energy change that occurs when an electron is added to isolated gaseous atom. More negative the electron gain enthalpy value, the higher an atom's affinity for electrons.
Electron gain enthalpy increases as we move from left to right across the periodic table.
Metals lose valence electrons to form cations to have a fully stable octet. Be is a metal with completely filled s orbitals (1s22s2) and hence it has the most endothermic electron gain enthalpy.
Nitrogen (1s22s22p3) has half-filled electronic configuration which is a stable configuration and hence it will have more electron gain enthalpy than B and C even though it lies to the right of carbon in the periodic table.