This is because of Avogadro's laws which states' Equal volumes of all gases, under similar conditions of temperature and pressure, contain equal number of molecules.
∴ 20 lit. nitrogen contains x molecules
∴ 10 lit. of chlorine will contain x *10/20 = x/2 mol.
and 20 lit of Ammonia will also contain = x molecules and 5 lit. of SO2 will contain
= x *5/20 = x/4 = mol.