The conjugate acid formed by addition of a proton to I is stabilised by two equivalent resonance structures and hence, compound I is the most basic. Further 2∘ amines (III) are more basic than 1∘ amines (II) while amides (IV) are least basic due to delocalisation of lone pair of electrons of N over the CO group. Thus, the order is : I > III > II > IV.