For each of the following oxidation-reduction reactions, identify which element is oxidized and which is reduced.
a. $\mathrm{Mg}(s)+\mathrm{Br}_{2}(l) \rightarrow \mathrm{MgBr}_{2}(s)$
b. $2 \mathrm{Na}(s)+\mathrm{S}(s) \rightarrow \mathrm{Na}_{2} \mathrm{~S}(s)$
c. $\mathrm{CO}_{2}(g)+\mathrm{H}_{2}(g) \rightarrow \mathrm{CO}(g)+\mathrm{H}_{2} \mathrm{O}(g)$
d. $6 \mathrm{~K}(s)+\mathrm{N}_{2}(g) \rightarrow 2 \mathrm{~K}_{3} \mathrm{~N}(s)$