$\mathrm{NH}_{3}$ on oxidation by bleaching powder gives gas $\mathrm{N}_{2}$ and byproducts. So $\mathrm{Q}$ is $\mathrm{N}_{2}$ $3 \mathrm{CaOCl}_{2}+2 \mathrm{NH}_{3} \rightarrow 3 \mathrm{CaCl}_{2}+3 \mathrm{H}_{2} \mathrm{O}+\mathrm{N}_{2}$
$\mathrm{N}_{2}$ on reaction with magnesium gives compound $\mathrm{Mg}_{3} \mathrm{N}_{2}$
$\mathrm{N}_{2}+3 \mathrm{Mg} \rightarrow \mathrm{Mg}_{3} \mathrm{N}_{2}$
$\mathrm{Mg}_{3} \mathrm{N}_{2}$ on hydrolysis gives $\mathrm{NH}_{3},$ which is nothing but $\mathrm{p}$. $\mathrm{Mg}_{3} \mathrm{N}_{2}+6 \mathrm{H}_{2} \mathrm{O} \rightarrow 3 \mathrm{Mg}(\mathrm{OH})_{2}+2 \mathrm{NH}_{3}$
So $\mathrm{P}, \mathrm{Q}, \mathrm{R}$ are $\mathrm{NH}_{3}, \mathrm{N}_{2}, \mathrm{Mg}_{3} \mathrm{N}_{2}$
Hence option A is correct.