The correct option is B S > R > P > Q
Due to Steric Inhibition in Resonace (SIR) effect, –N(CH3)2 becomes out of the plane in (S) and donot participate in ring resonance. As a result this becomes most basic.
p-Nitroaniline has an electron withdrawing group in the para position and due to this EWG the lone pair of NH2 is more stabilized by resonance and availability of the lone pair becomes less than that of aniline.
Hence the order becomes S > R > P > Q