I think it shud be A>B>C>D
In C there is O which is decreasing the basicity, whereas there is nothing present in B which can decrease its basicity. Even the l.p. of N in B is not involved in conjugation, so its easily available.
So, it means B>C.
And, in D, due to conjugation of lp of N, it is least basic and aliphatic amines are more basic than aromatic ones, so A is most basic.
So the overall order shud be A>B>C>D.