Consider the following sets of H-bonds:
$$ \begin{align} &\text{P:} &\ce{-O-H\bond{....}N} \\ &\text{Q:} &\ce{-O-H\bond{....}O} \\ &\text{R:} &\ce{-N-H\bond{....}N} \\ &\text{S:} &\ce{-N-H\bond{....}O} \end{align} $$
Since oxygen is more electronegative $(\mathrm{EN})$ and polarises the hydrogen more than nitrogen, I think the order of decreasing strength is Q > P > S > R.
But the correct answer is P > Q > R > S. The reason given is that for H-bonding in
$$\ce{-A-H\bond{....}B}$$
to be strong, $\mathrm{EN}(\ce{A}) > \mathrm{EN}(\ce{B})$ and $\ce{B}$ should be electron-rich.
I am not able to understand where I went wrong.