The inductive effect of a second nitrogen makes all three of these heterocycles less basic than pyridine.
negative inductive effect decreases electron density around the N (therefore basicity) for 1,2 compounds more than for 1,3 compounds.
Including EWG (O or S) also pulls away the electron density