Compound, III is most basic as the lone pair of nitrogen is easily available for the donation. In case of compound (I) lone pair is not involved in resonance but nitrogen atom is sp2 hybridsed, whereas in compound II the lone pair of nitrogen is involved in aromaticity which makes it least basic.