First we have to understand what affects basic nature of a compound.
- Tendency to donate lone pair
- Electronic effects— Inductive, resonance etc
- Factors stabilizing conjugate acid (or acidity of conjugate acid
- Nature of solvent
Tendency to donate lone pair is affected by the acidity of conjugate acid and electronic effects.
Grab a pen and paper and draw conjugate acids of
- $$2-nitroaniline$$
- $$3-nitroanliline$$
- $$4-nitroaniline$$
And you know that electron withdrawing inductive (–I) effect increases acidity and electron withdrawing resonance (–M or –R) also increases acidity.
In conjugate acid of
- $$2-nitroaniline$$
You will find there is only –I inductive effect and there is no –M effect of $-NO_2$ group because of SIR (In SIR - STERIC INHIBITION OF RESONANCE - the nitro $-NO_2$ group shows steric hindrance to $-NH_3^+$ group and the p–orbital of Nitrogen (in $-NH_3^+$ group) moves out of plane of p–orbital of Carbon (in benzene ring) which inhibits resonance or does not allow resonance to happen). So in conjugate acid of $2-nitroanliline$ there is only –I effect which increases acidity.
- $$3-nitroanliline$$
You will find that there is no –M effect obviously!! But there is –I effect of nitro ($-NO_2$) group which increase the acidity of conjugate acid of $3-nitroanliline$ but it is less than what we have seen in $2-nitroanliline$ (due to distance factors). Therefore conjugate acid of $2-nitroanliline$ is more acidic than conjugate acid of $3-nitroanliline$
- $$4-nitroanliline$$
You will find there are both –M and –I effect which increase acidity of conjugate acid of $4-nitroanliline$. So conjugate acid of $4-nitroanliline$ is more acidic than conjugate acid of $3-nitroanliline$ or $2-nitroanliline$
Conclusion
Order of acidity of conjugate acids
$$conj.\ acid\ of\ 3-nitroanliline<conj.\ acid\ of\ 2-nitroanliline<conj.\ acid\ of\ 4-nitroanliline$$
Since the order of basicity of 'orginal' compounds is just opposite of order of acidity of conjugate acids, so answer to your question is as follows
$$3-nitroanliline>2-nitroanliline>4-nitroanliline$$
Or m>o>p