Electron withdrawing groups (EWG) reduce electron density and reduce basicity. Resonance delocalizes electron density and so also decreases basicity (the electrons are less available to pick up a proton).
Electron donating groups (EDG) add electron density and increase basicity.
Alkyl groups are weakly EDG (induction), and hydrogen is neither EDG nor EWG. So cyclohexylamine (compound X) is a stronger base than ammonia (compound W).
Aniline (compound Y) has resonance, so it is less basic than compound X, which does not have resonance.
N-acyl aniline (compound Z) has more resonance forms than aniline, so it will be the least basic.
So the overall over is:
(most basic) X > W > Y > Z (least basic)